I am trying to override a non-deterministic encryption function from javascript to java. However, I noticed that the output of the function is different every time. However, whenever I decrypt the output, it always returns the source text.
For instance:
word: hello
encrypted :? Hx? 631ffe50353ddda632a7e8fa11136d6ffaa584eb43b34c96005b6256f9dc 4121c7a8545d79887b900672e5870d702441? H
decrypted: hello
word: hello
encrypted :? Hx? dfea4d1d30ebd5fc871c7c92d0230baf9e5298b19c3cfa0770fe2d2035f8 dad0116f2963b115c85c9d4725be505fca54? H
decrypted: hello
etc....
In unit test, this, as I can imagine, is also to implement the decryption function in java and then decrypt the output of the encryption function. If decryption gives the source, then encryption is correct.
For instance:
encrypted = Encrypt_text(word); assertEquals(word,Decrypt_text(encrypted);
Any other suggestions ...?
source share