Random Substitution Cipher
This commit is contained in:
7
random-substitution-cipher/index.js
Normal file
7
random-substitution-cipher/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// https://www.codewars.com/kata/random-substitution-cipher/javascript
|
||||
|
||||
function randomSub() {
|
||||
const alph = 'abcdefghijklmnopqrstuvwxyz'.split``;
|
||||
const rnd = alph.slice().sort(() => Math.random()-0.5);
|
||||
return alph.reduce((res, k, i) => (res[k] = rnd[i], res), {});
|
||||
}
|
||||
Reference in New Issue
Block a user