B4J Question Inline Java Problem

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
Hi, Can anyone check/fix why I got error, please?
It is a simple hashing sha-256 Java code, but I'm not familiar with JAVA !!

Thanks
 

Attachments

  • hash.zip
    1.5 KB · Views: 170

drgottjr

Expert
Licensed User
Longtime User
presumably, erel's recommendation is the one to follow (as usual).

but just so you know, your project is easy to get working, and i'm no java programmer. not sure why nobody else has stepped forward.

anyway, the attached is your project with my changes. there are a 1000 better ways to do this.

if you can look at my version and yours side by side, you will see the changes. the real changes are in the inline Java part. basically, you didn't have a major import and some of the functions need to be declared as throwing exceptions (or trapped for exceptions). i chose to implement the latter. a Java programmer would probably use the former. and once i put those functions inside try/catch blocks, i had to move some declarations to a different part of the code.

how sound the code is, i don't know. but i thought you might like to see how the thing runs in b4j (which it does). it could easily be optimized and put in a little library by someone with a modicum of Java experience. that failing, try the encryption library.
 

Attachments

  • hash2.zip
    1.6 KB · Views: 180
Upvote 0
Top