www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - What's up with the 'cent' type?

reply kinghajj <kinghajj_member pathlink.com> writes:
It looks interesting... when will it be completed? 16-bytes can hold alot of
data ;) ... just think about the cryptology uses!

When it is implemented, will there be phobos functions to take many other types
(say, bytes/ubyes) and combine them into one cent?
Aug 17 2004
parent Arcane Jill <Arcane_member pathlink.com> writes:
In article <cftnob$1e11$1 digitaldaemon.com>, kinghajj says...
It looks interesting... when will it be completed? 16-bytes can hold alot of
data ;) ... just think about the cryptology uses!

I wrote the class Int for that very purpose. Ints are unlimited precision integers. You will find them in etc.bigint.bigint in Deimos on dsource. I notice you said "cryptology" instead of "cryptography". May I assume you have some cryptanalysis in mind? I'd be intrigued if so.
When it is implemented,

Don't know. But it the meantime, it would be pretty easy to fake it up, using something like: # struct ucent # { # uint[4] array; # # /* functions */ # } Of course (gripe) you still wouldn't be able to say # cent n = 4; but the actually arithmetic would be dead straightforward. In actual fact, you could implement ucent arithmetic entirely using the low-level functions in etc.bigint. Signed cents would need a little more work, but not much.
will there be phobos functions to take many other types
(say, bytes/ubyes) and combine them into one cent?

I imagine it will be treated in exactly the same way as every other primitive integer type. So yes - use a union. Arcane Jill
Aug 17 2004