SHA256

Richard Gaskin ambassador at fourthworld.com
Mon Dec 15 14:56:46 EST 2014


José Antonio Rocha wrote:
> 2014-12-15 17:25 GMT-02:00 Richard Gaskin:
>> LiveCode currently provides only two hashes, MD5 and SHA1.  I have a
>> project in which I need SHA256.  Anyone here have a function for that?
>>
> Hi!
> There is this, but I could not make it work:
> http://masmit.net/libhash-hmac.html

Brilliant! Works great.

To make that lib work the only modification needed is to comment out the 
function definition for sha1digest, since that's now a built-in LiveCode 
function.

Using that lib I ran this:

      put sha256.hex("ambassador at fourthworld.com")

...and verified it against OS X's implementation using a simple text 
file with the same string:

     shasum -a 256 ~/Desktop/addy.txt

Both returned:

     a14aa8957080619214e553cb552e7bf4bdbce216813d1bce2b50ea74a97a95e4

Another success story thanks to the late great Mark Smith.  Thanks for 
turning me onto that library.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list