I would like to import the sha256 algorithm into my app.
In the Internet I found some lines which could do it using the
java.security.MessageDigest package:
import java.security.MessageDigest;
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update("123456");
byte byteData[] = md.digest();
The following lines with a translation to Hecl are just a guess:
java MessageDigest sha256
set sha256 [sha256 -new {SHA-256}]
$sha256 -method update "123456"
set result [$sha256 -method digest]
As I didn't know how to feed the sha256 object I would be glad if I could get a suggestion.
My test failed already in the beginning:
> java MessageDigest sha256
HeclServer error: {ERROR {java.lang.ClassNotFoundException: MessageDigest} 3} {java 1} {eval 1}
Where is Hecl(-Server) looking for the classes?
And:
Let's say I succeed in compiling a sha256.so on Android. Could it be loaded with something like:
java System.load load
set result [load -new sha256.so]
Sorry, for the amount of questions but I am new to Java.