Reply to topic  [ 2 posts ] 
md5 and sha1 require arrays of size 16 or larger 
Author Message
Yorick Master

Joined: Wed Jun 01, 2005 11:34 am
Posts: 112
Post md5 and sha1 require arrays of size 16 or larger
Both md5 and sha1 exhibit this behavior, but I'll just use md5 to illustrate:

Code:
> md5(indgen(16))
[0xde,0x98,0xb0,0xf7,0xff,0xb9,0x59,0x83,0x72,0xb2,0xcd,0x3a,0x11,0xf2,0x9e,
0x03]

> md5(indgen(15))
ERROR (*main*) Segmentation violation interrupt (SIGSEGV)
WARNING source code unavailable (try dbdis function)
now at pc= 1 (of 16), failed at pc= 9
To enter debug mode, type <RETURN> now (then dbexit to get out)

> state = []
> md5, state, indgen(16)
> md5, state, indgen(15)
ERROR (*main*) Segmentation violation interrupt (SIGSEGV)
WARNING source code unavailable (try dbdis function)
now at pc= 1 (of 17), failed at pc= 11
To enter debug mode, type <RETURN> now (then dbexit to get out)

> md5(span(0, 1, 16))
[0x08,0x69,0xbf,0xb2,0xd1,0x99,0x0c,0xcd,0xd1,0x08,0x19,0xd3,0xcc,0xe0,0x8a,
0xd6]

> md5(span(0, 1, 15))
ERROR (*main*) Segmentation violation interrupt (SIGSEGV)
WARNING source code unavailable (try dbdis function)
now at pc= 1 (of 20), failed at pc= 13
To enter debug mode, type <RETURN> now (then dbexit to get out)

> md5("")
[0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04,0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,
0x7e]


They work on strings of any length. They work on arrays of long and double of length 16 or greater. But they seg fault when given an array of size less than 16, even if you're using the form that builds up a result in multiple calls.

The issue exists on both systems I tested it on.

Am I using the functions wrong? The documentation doesn't mention anything about this issue.


Tue Dec 10, 2013 12:41 pm
Profile
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: md5 and sha1 require arrays of size 16 or larger
Oops. It actually failed for a great many lengths -- anything with a byte count that had remainder in a particular range. It is fixed with commit 6a54c75 at github. Thank you very much for reporting this.


Fri Dec 13, 2013 9:04 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.