charsyam / hashids_rust

rust hashids implements
MIT License
60 stars 13 forks source link

Unable to decode after encoding with padding #4

Open archer884 opened 8 years ago

archer884 commented 8 years ago

I was doing some performance testing with @Dr-Emann's version of this (can't get the normal version to run?) and it looks like it's not able to decode things encoded with padding.

Sample code:

let hashid = HashIds::new("this is my salt".into()).unwrap();
let encoded_values: Vec<_> = (1..1001).map(|n| hashid.encode(&[n])).collect();
for value in encoded_values.iter().map(|s| (s, hashid.decode(s))) {
    println!("{:?}", value);
}