[Cryptography Team] Integer>>#asByteArray - "asn1 encoding"
Chris Muller
chris at funkyobjects.org
Mon Dec 19 02:59:40 CET 2005
Does anyone mind if we rename this method to.. asAsn1Bytes or something?
#asByteArray would seem to be more appropriate for getting the LargeInteger's
internal representation as a ByteArray. Print this script to demonstrate how
#asByteArray is exactly reversed of the Integers internal representation.
| ba i |
i _ 873984723987498. "a LargePositiveInteger"
ba _ ByteArray new: i size.
ba
replaceFrom: 1
to: ba size
with: i
startingAt: 1.
{ ba. i asByteArray }
This selector, #asByteArray, should have already been implemented in base
Squeak and usable by serialization for example, but it wasn't yet.
Nevertheless, asn1-specific code should not hog this name in the namespace.
I'd like to give it back along with an implementation of #asByteArray that is
congruent with its internal representation.
However, I'm not sure where we are in terms of our lock down..
More information about the Cryptography
mailing list