7 lines
379 B
Text
7 lines
379 B
Text
class SubstitutionCipher{
|
|
// 92 characters: " !"#$%&" ... "xyz{|}", doesn't include "~"
|
|
const KEY="]kYV}(!7P$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs\"v*N"
|
|
"[#wSl9zq2^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\\C1yxJ";
|
|
fcn encode(s){ s.apply(fcn(c){ try{ KEY[c.toAsc()-32] }catch{ c } }) }
|
|
fcn decode(s){ s.apply(fcn(c){ try{ (KEY.index(c)+32).toChar() }catch{ c } }) }
|
|
}
|