Alright, I think I have it working pretty well, now! My arbitrary length positive integer codec for arbitrary ascii encoding is "finished"!
I can convert numeric (dec, bin, ter, quad, etc.), alphabetical, alphanumeric (case sensitive and non-sensitive, like hex, bech32, base58), other non-alphanumeric like base64 (includes a '+' and a '/'), and any arbitrary encoding that can be expressed as a non-repeating sequence of characters (can be expressed as a Vec
I took a base64 integer of length 8161 digits (the max length the command line would allow me to enter) and converted to alphabetical, hex, and decimal, and it only took a couple seconds.
There are a few optimizations I could make, like checking for bases of powers of two and using shifts rather than multiplications and divides, doing more bulk operations of the Vec
I think I might also be able to create a few new large-integer types that would act like u256, u512, u2048, etc., using arrays rather than vectors, and that might unlock more optimizations. However, this was only a challenge I gave myself so I could learn Rust, so I might not so I can move on to learn more and start on other projects.
What do I do with it now?
#learnRust #rust #ask Nostr