开发者

Can you call OpenSSL's hash primitives from Java?

Has anyone developed JNI bindings to call OpenSSL's hash functions from Java?

I am aware that Java has hash functions built in. The problem is that these run at only a third th开发者_运维知识库e speed of the OpenSSL native implementations. There is an OpenSSL-Java project on sourceforge, but it has no files to download.

My goal here is actually not to call OpenSSL, it is to overcome Java's suboptimal performance regarding hashing.


Try https://www.nayuki.io/page/native-hash-functions-for-java they implement hash functions in c, x86 assembly and x86-64 assembly

Boost up to 1.68× for SHA-256, but I see no difference with small files.

So If you tend to use with small file, I suggest stick with java.


I strongly believe you have to write a C routine that not only calculated the hashes, but also does the file IO. Don't forget to use memory mapped IO for speed, else the limiting part is you copying buffers.


Apparently you can but it's because of JNI you don't get the performance boost.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜