Switch to desktop version  
MD5 Checksum with BASIC - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html)
+--- Thread: MD5 Checksum with BASIC (/thread-80.html)



MD5 Checksum with BASIC - FromTicket - 23-05-2016

Hi,

Is there a way to compute a MD5 checksum from the BASIC of eWON ?


RE: MD5 Checksum with BASIC - simon - 23-05-2016

There is no BASIC function to do that.
However, I have found a MD5 library on the Internet to develop that in JAVA.

Since you want to use BASIC to program your eWON, I have added in the JAVA program a simple TELNET server.
The idea is to use an Internal TELNET connection to make the BASIC program communicate to the JAVA program.

So, to use it, just drop the JAVA files (See in MD5.zip) : MD5.jar, MD5.jad and jvmrun in the /usr directory of your eWON and reboot it.
Then in BASIC, use the function "OPEN" to open a socket to the eWON itself. See the below example :
Code:
A$ = @MD5$("hello")
Print A$

Function MD5$($string$)
 OPEN "tcp:192.168.120.91:333" FOR BINARY OUTPUT AS 1
$loop:
 $buf$ = GET 1
 If ($buf$="#CLOSED#") THEN GOTO $loop
 PUT 1,$string$ + CHR$(13)
 @delay%(1000)
 $Result$ = GET 1,100
 @delay%(100)
 PUT 1,"exit" + CHR$(13)
 Close 1
 $MD5$ = $Result$
EndFn

Function delay%($msec%)
$start% =GETSYS PRG,"MSEC"
$loop:
For $i%=1 To 1000
Next $i%
$now% = GETSYS PRG,"MSEC"
$delay% = $now% - $start%
If ($delay% <$msec%) Then GOTO $loop
EndFn

PS : 192.168.120.91 is the eWON LAN IP address.