--- a/SHA1Stream.st Thu Feb 07 09:53:25 2013 +0100
+++ b/SHA1Stream.st Tue Mar 05 18:10:13 2013 +0000
@@ -100,7 +100,7 @@
unsigned long a, b, c, d, e;
typedef union {
unsigned char c[64];
- unsigned long l[16];
+ unsigned int32 /* long */ l[16];
} CHAR64LONG16;
CHAR64LONG16* block;
#ifdef SHA1HANDSOFF
@@ -308,28 +308,29 @@
This may be used as checksum or for generating cryptographic signatures.
Notice (2005):
- Be aware that SHA-1 is considered broken and may not be appropriate in some applications.
- Especially it should no longer be used for security stuff.
+ Be aware that SHA-1 is considered broken and may not be appropriate in some applications.
+ Especially it should no longer be used for security stuff.
performance: roughly
- 47400 Kb/s on a 2Ghz Duo
- 9580 Kb/s on a 400Mhz PIII
- 3970 Kb/s on a 300Mhz Sparc
+ 120400 Kb/s on a 2.5Ghz 64X2 Athlon 4800+ (64bit)
+ 47400 Kb/s on a 2Ghz Duo (old measure)
+ 9580 Kb/s on a 400Mhz PIII
+ 3970 Kb/s on a 300Mhz Sparc
[author:]
- Stefan Vogel
+ Stefan Vogel
[see also:]
- MD5Stream
- SHA256Stream SHA512Stream (in libcrypt)
+ MD5Stream
+ SHA256Stream SHA512Stream (in libcrypt)
[class variables:]
- HashSize size of returned hash value
- ContextSize (implementation) size of hash context
+ HashSize size of returned hash value
+ ContextSize (implementation) size of hash context
[instance variables:]
- hashContext (implementation)
- internal buffer for computation of the hash value
+ hashContext (implementation)
+ internal buffer for computation of the hash value
"
!
@@ -486,15 +487,18 @@
digest := ByteArray new:HashSize.
%{
- if (__isByteArray(__INST(hashContext)) &&
- __byteArraySize(__INST(hashContext)) == sizeof(SHA1_CTX) &&
+ OBJ hcon;
+
+ hcon = __INST(hashContext);
+ if (__isByteArray(hcon) &&
+ __byteArraySize(hcon) == sizeof(SHA1_CTX) &&
__isByteArray(digest) &&
__byteArraySize(digest) == 20
) {
- SHA1_CTX *ctx = (SHA1_CTX *)__ByteArrayInstPtr(__INST(hashContext))->ba_element;
+ SHA1_CTX *ctx = (SHA1_CTX *)(__ByteArrayInstPtr(hcon)->ba_element);
SHA1_CTX copyContext;
- memcpy(©Context, ctx, sizeof(copyContext));
+ memcpy(©Context, ctx, sizeof(SHA1_CTX));
SHA1Final(__ByteArrayInstPtr(digest)->ba_element, ©Context);
RETURN(digest);
}
@@ -578,11 +582,11 @@
!SHA1Stream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.33 2013-01-27 13:55:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.36 2013-02-21 10:44:11 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.33 2013-01-27 13:55:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/SHA1Stream.st,v 1.36 2013-02-21 10:44:11 cg Exp $'
! !