Strongly-typed ascii character rotations in the style of Caesar/Rot/Vigenère ciphers.
This is only meant to be some fun with type-level integers in Rust.
Please do not use this as an encryption scheme as it is laughably weak.
RotIter | Wraps a raw character/byte iterator and rotates each item.
|
RotU8 | A wrapper over Ascii u8 which rotates alphabetic characters by N .
This is essentially a per-character Caesar cipher with a shift of N .
A collection of this type may also be used to implement a strongly-typed Vigenère cipher.
An interesting characteristic is that this type can only be converted back to
a raw u8 when it has been rotated back into place (i.e N % 26 == 0 ),
otherwise it is a compile-time type error to do so.
It is also type-parameterized over the rotation length to prevent
partial/improper ciphers at compile-time.
This makes it impossible to use a byte rotated right by 12 when a type contract
requires a byte rotated left by 13, for example.
|