[squeak-dev] The Trunk: System-ul.831.mcz

commits at source.squeak.org commits at source.squeak.org
Thu May 19 08:44:18 UTC 2016


Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.831.mcz

==================== Summary ====================

Name: System-ul.831
Author: ul
Time: 19 May 2016, 10:43:32.712543 am
UUID: 71e758e2-381c-4c5a-84b5-87e206f286a9
Ancestors: System-mt.830

- use #adoptInstance: instead of copying the ByteArray into a new LargeInteger in SecureHashAlgorithm >> #finalHash. This should be somewhat quicker and it should also avoid running the fallback code of LargePositiveInteger >> #replaceFrom:to:with:startingAt: with a ByteArray argument, which wouldn't work.

=============== Diff against System-mt.830 ===============

Item was changed:
  ----- Method: SecureHashAlgorithm>>finalHash (in category 'private') -----
  finalHash
  	"Concatenate the final totals to build the 160-bit integer result."
  	"Details: If the primitives are supported, the results are in the totals array. Otherwise, they are in the instance variables totalA through totalE."
  
  	| result |
  	result := ByteArray new: 20.
  	totals 
  		ifNil: [ "compute final hash when not using primitives"
  			result
  				unsignedShortAt: 1 put: totalE low bigEndian: false;
  				unsignedShortAt: 3 put: totalE hi bigEndian: false;
  				unsignedShortAt: 5 put: totalD low bigEndian: false;
  				unsignedShortAt: 7 put: totalD hi bigEndian: false;
  				unsignedShortAt: 9 put: totalC low bigEndian: false;
  				unsignedShortAt: 11 put: totalC hi bigEndian: false;
  				unsignedShortAt: 13 put: totalB low bigEndian: false;
  				unsignedShortAt: 15 put: totalB hi bigEndian: false;
  				unsignedShortAt: 17 put: totalA low bigEndian: false;
  				unsignedShortAt: 19 put: totalA hi bigEndian: false ]
  		ifNotNil: [ "compute final hash when using primitives"
  			result
  				unsignedLongAt: 1 put: (totals at: 5) bigEndian: false;
  				unsignedLongAt: 5 put: (totals at: 4) bigEndian: false;
  				unsignedLongAt: 9 put: (totals at: 3) bigEndian: false;
  				unsignedLongAt: 13 put: (totals at: 2) bigEndian: false;
  				unsignedLongAt: 17 put: (totals at: 1) bigEndian: false ].
+ 	LargePositiveInteger adoptInstance: result.
+ 	^result normalize!
- 	^(LargePositiveInteger new: result size)
- 		replaceFrom: 1
- 			to: result size
- 			with: result
- 			startingAt: 1;
- 		normalize!



More information about the Squeak-dev mailing list