Dear All,
I'm new on automagic and i can't write script, please help me how to calculate hash using MD5 or SHA1
Condition :
I have 2 file :
--> file-01.txt
--> file-02.txt
What i want is :
--> CHECK both HASH file, it can be using MD5 or SHA1
--> COMPARING both file, to see if file is the same
--> LOGING the comparing result.
Is anyone here can help me, i'm already searching on this forum and can't find any reference how to check HASH file.
Thank You
[ASK] -- Calculate Hash Using algorithm MD5 or SHA1
Moderator: Martin
Re: [ASK] -- Calculate Hash Using algorithm MD5 or SHA1
Hi,
Automagic currently only supports to create a hash within an action Script from an input text.
Following flows could work:
-action Action Init Variable Text File: file1.txt to file_text1
-action Action Init Variable Text File: file2.txt to file_text2
-action Script with:
You could also use a condition Expression to check if the hashes are the same (almost the same as above):
-action Action Init Variable Text File: file1.txt to file_text1
-action Action Init Variable Text File: file2.txt to file_text2
-condition Expression with:--> true: action Notification on Screen: files are the same
--> false: action Notification on Screen: files are not the same
Alternatively you could also read and check the output of command md5 which is available on many ROMs (action Execute Command: md5 file1.txt).
Regards,
Martin
Automagic currently only supports to create a hash within an action Script from an input text.
Following flows could work:
-action Action Init Variable Text File: file1.txt to file_text1
-action Action Init Variable Text File: file2.txt to file_text2
-action Script with:
Code: Select all
h1 = hash(file_text1, "utf-8", "sha1");//or "md5"
h2 = hash(file_text2, "utf-8", "sha1");//or "md5"
log(h1==h2);//either logs true or false
-action Action Init Variable Text File: file1.txt to file_text1
-action Action Init Variable Text File: file2.txt to file_text2
-condition Expression with:
Code: Select all
h1 = hash(file_text1, "utf-8", "sha1");//or "md5"
h2 = hash(file_text2, "utf-8", "sha1");//or "md5"
h1==h2;
--> false: action Notification on Screen: files are not the same
Alternatively you could also read and check the output of command md5 which is available on many ROMs (action Execute Command: md5 file1.txt).
Regards,
Martin
Re: [ASK] -- Calculate Hash Using algorithm MD5 or SHA1
Thank You Martin>>> <<(ง°▼°)ง