in squeak trunk
Can some of you double check this change from squeaktrunk Name: Files-jcg.27 In squeak checkSum: aString "Construct a checksum of the string. A three byte number represented as Base64 characters." | sum shift bytes | sum := aString size. shift := 0. aString do: [:char | (shift := shift + 7) > 16 ifTrue: [shift := shift - 17]. "shift by 7 to keep a change of adjacent chars from xoring to same value" sum := sum bitXor: (char asInteger bitShift: shift) ]. bytes := ByteArray new: 3. sum := sum + 16r10000000000. 1 to: 3 do: [:ind | bytes at: ind put: (sum digitAt: ind)]. ^bytes base64Encoded In pharo checkSum: aString "Construct a checksum of the string. A three byte number represented as Base64 characters." | sum shift bytes ss bb | sum := aString size. shift := 0. aString do: [:char | (shift := shift + 7) > 16 ifTrue: [shift := shift - 17]. "shift by 7 to keep a change of adjacent chars from xoring to same value" sum := sum bitXor: (char asInteger bitShift: shift)]. bytes := ByteArray new: 3. sum := sum + 16r10000000000. 1 to: 3 do: [:ind | bytes at: ind put: (sum digitAt: ind)]. ss := ReadWriteStream on: (ByteArray new: 3). ss nextPutAll: bytes. bb := Base64MimeConverter mimeEncode: ss. ^ bb contents Thanks _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
It's same code, but pharo String does not respond to #base64Encoded
Nicolas 2010/1/15 Stéphane Ducasse <[hidden email]>: > in squeak trunk > Can some of you double check this change from squeaktrunk Name: Files-jcg.27 > > In squeak > checkSum: aString > "Construct a checksum of the string. A three byte number represented as Base64 characters." > | sum shift bytes | > sum := aString size. > shift := 0. > aString do: [:char | > (shift := shift + 7) > 16 ifTrue: [shift := shift - 17]. > "shift by 7 to keep a change of adjacent chars from xoring to same value" > sum := sum bitXor: (char asInteger bitShift: shift) > ]. > bytes := ByteArray new: 3. > sum := sum + 16r10000000000. > 1 to: 3 do: [:ind | bytes at: ind put: (sum digitAt: ind)]. > ^bytes base64Encoded > > > > In pharo > > checkSum: aString > "Construct a checksum of the string. A three byte number represented as Base64 characters." > | sum shift bytes ss bb | > sum := aString size. > shift := 0. > aString do: [:char | > (shift := shift + 7) > 16 ifTrue: [shift := shift - 17]. > "shift by 7 to keep a change of adjacent chars from xoring to same value" > sum := sum bitXor: (char asInteger bitShift: shift)]. > bytes := ByteArray new: 3. > sum := sum + 16r10000000000. > 1 to: 3 do: [:ind | bytes at: ind put: (sum digitAt: ind)]. > ss := ReadWriteStream on: (ByteArray new: 3). > ss nextPutAll: bytes. > bb := Base64MimeConverter mimeEncode: ss. > ^ bb contents > > Thanks > > > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
It does in 11161. Strange, do you have a different version?
Stef On Jan 15, 2010, at 9:12 PM, Nicolas Cellier wrote: > It's same code, but pharo String does not respond to #base64Encoded > > Nicolas > > 2010/1/15 Stéphane Ducasse <[hidden email]>: >> in squeak trunk >> Can some of you double check this change from squeaktrunk Name: Files-jcg.27 >> >> In squeak >> checkSum: aString >> "Construct a checksum of the string. A three byte number represented as Base64 characters." >> | sum shift bytes | >> sum := aString size. >> shift := 0. >> aString do: [:char | >> (shift := shift + 7) > 16 ifTrue: [shift := shift - 17]. >> "shift by 7 to keep a change of adjacent chars from xoring to same value" >> sum := sum bitXor: (char asInteger bitShift: shift) >> ]. >> bytes := ByteArray new: 3. >> sum := sum + 16r10000000000. >> 1 to: 3 do: [:ind | bytes at: ind put: (sum digitAt: ind)]. >> ^bytes base64Encoded >> >> >> >> In pharo >> >> checkSum: aString >> "Construct a checksum of the string. A three byte number represented as Base64 characters." >> | sum shift bytes ss bb | >> sum := aString size. >> shift := 0. >> aString do: [:char | >> (shift := shift + 7) > 16 ifTrue: [shift := shift - 17]. >> "shift by 7 to keep a change of adjacent chars from xoring to same value" >> sum := sum bitXor: (char asInteger bitShift: shift)]. >> bytes := ByteArray new: 3. >> sum := sum + 16r10000000000. >> 1 to: 3 do: [:ind | bytes at: ind put: (sum digitAt: ind)]. >> ss := ReadWriteStream on: (ByteArray new: 3). >> ss nextPutAll: bytes. >> bb := Base64MimeConverter mimeEncode: ss. >> ^ bb contents >> >> Thanks >> >> >> >> _______________________________________________ >> Pharo-project mailing list >> [hidden email] >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project >> > > _______________________________________________ > Pharo-project mailing list > [hidden email] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [hidden email] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project |
Free forum by Nabble | Edit this page |