skip32 0.1.0

skip32 block cipher
docs.rs failed to build skip32-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: skip32-1.0.5

SKIP32 is a 80-bit key, 32-bit block cipher based on SKIPJACK.

It has the uncommon properties of being fast, creating very dissimilar encrypted values for consecutive input values, and producing output of the same size as the input (32-bit). These make this cipher particularly useful for obfuscating series of 32-bit integers (e.g. auto-incremented database ids). It is not appropriate for general cryptography.

CPAN - Crypt::Skip32 has more information.

A copy of the original source code that this is based on can be found in skip32.c.

Example

// keys are plain byte arrays
let key: &[u8; 10] = &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// input and output blocks are u32
let encoded: u32 = skip32::encode(key, 1000);
// every input has a unique output
assert!(encoded == 2109307140);
let decoded = skip32::decode(key, encoded);
assert!(decoded == 1000);