M hashids.janet => hashids.janet +1 -1
@@ 20,7 20,7 @@
(var p 0)
(loop [i :down [(- (length alph-bytes) 1) 0]]
- (let [v (mod i (length salt-bytes))
+ (let [v (mod (- (length alph-bytes) i 1) (length salt-bytes))
n (get salt-bytes v)]
(set p (+ p n))
(def j (mod (+ n v p) i))
M test/consistent-shuffle.janet => test/consistent-shuffle.janet +8 -0
@@ 14,5 14,13 @@
(assert
(= "cadb" (h/consistent-shuffle "abcd" salt)))
+(assert
+ (= "f17a8zvCwo0iuqYDXlJ4RmAS2end5ghTcpjbOWLK9GFyE6xUI3ZBMQtPsNHrkV"
+ (h/consistent-shuffle "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
+ "salt")))
+
+
+
+ <
\ No newline at end of file