Hello guys,
I develop pgp mobile application using openpgpjs. A few days ago I had an idea why not to use native cryptographic functions from the device. As I use cordova I want to create a jnext native plugin. I have started with a simple hash functions (see the comparison times below, with the different algorithms and input length). I have realized that running a jnext plugin takes some time and it is not always a good idea. For sha1 native code always loses, but others algorithms are much faster, especially when the data is long.
The side effect is that probably I will have to encode somehow the input string (for normal strings it is fine, but then I found you send char(0) which cuts the string on c++ side...). If I use conversion to hex (it needs time...), my string will be double long. I must check how to save some memory, as jnext does not care about it (they do a lot of json conversions and concatenations, which produce a new string in the memory, as I think).
So, this is my idea. Later I will think how to plug my solution instead of original ones, but now I would like to ask for two things. First at all: does any one used jnext or have an idea how to increase the performance of each call?
And the second one. Forgive me if you find it silly, I am not a cryptographic expert. I would like to know what can I expect as a input for the functions. For example: I have seen you use hash for private key decryption - what could be a input, just an ascii string (with this unfortunate char(0)), what could be the input length? Maybe you never send so long values so I will never have such profit.
Later I will play with encryption/decryption functions, but for a now I want to have a satisfying results of a hashing methods. Maybe you have other idea which function I should try to call to have a interesting profit.
Probably there is not so much to play with an atomic functions and for sure it would be better to rewrite application into native c, but I want to play a little and find a places to improve.
sha512 1024 n11 vs o28
sha512 1048576 n540 vs o1909
sha512 2097152 n1194 vs o3368
sha512 4194304 n2680 vs o6024
sha384 1024 n32 vs o6
sha384 1048576 n721 vs o1684
sha384 2097152 n1321 vs o3448
sha384 4194304 n2106 vs o6109
sha256 1024 n28 vs o18
sha256 1048576 n694 vs o3721
sha256 2097152 n1300 vs o6938
sha256 4194304 n2042 vs o14640
sha224 1024 n73 vs o8
sha224 1048576 n685 vs o3857
sha224 2097152 n1281 vs o6818
sha224 4194304 n2047 vs o14132
sha1 1024 n27 vs o7
sha1 1048576 n547 vs o275
sha1 2097152 n1301 vs o515
sha1 4194304 n2494 vs o1019
--
Pozdrawiam
Paweł Górny
Sent from my BlackBerry Passport
Pozdrawiam
Paweł Górny
Sent from my BlackBerry Passport
_______________________________________________
http://openpgpjs.org Subscribe/unsubscribe: http://list.openpgpjs.org

