How to import Java code into Hecl for Android?

18 views
Skip to first unread message

zdia

unread,
Jul 11, 2011, 9:44:25 AM7/11/11
to he...@googlegroups.com
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.

 

zdia

unread,
Jul 22, 2011, 4:13:37 AM7/22/11
to he...@googlegroups.com
See: http://www.hecl.org/docs/creating_new_hecl_commands.html

and:

/hecl/load/org/hecl/load/LoadCmd.java

Reply all
Reply to author
Forward
0 new messages