Crate squishyid

source ·
Expand description

Shortens and obfuscates your IDs at the same time.

Useful for:

  • Hiding real database IDs in URLs or REST APIs.
  • Saving space where it is limited, like in SMS or Push messages.

§Examples

use squishyid::SquishyID;

let s = SquishyID::new(
    "2BjLhRduC6Tb8Q5cEk9oxnFaWUDpOlGAgwYzNre7tI4yqPvXm0KSV1fJs3ZiHM"
).unwrap();

let encoded: String = s.encode(48888851145);
assert_eq!(encoded, "1FN7Ab");

let decoded: u64 = s.decode("1FN7Ab").unwrap();
assert_eq!(decoded, 48888851145);

Check out SquishyID for detailed methods description.

§Other implementations

Structs§