2018-05-09 21:18:33 +02:00
/ * *
* @ author Matt C [ matt @ artemisbot . uk ]
* @ copyright Crown Copyright 2016
* @ license Apache - 2.0
* /
2019-07-09 13:23:59 +02:00
import Operation from "../Operation.mjs" ;
import { affineEncode } from "../lib/Ciphers.mjs" ;
2018-05-09 21:18:33 +02:00
/ * *
* Atbash Cipher operation
* /
class AtbashCipher extends Operation {
/ * *
* AtbashCipher constructor
* /
constructor ( ) {
super ( ) ;
this . name = "Atbash Cipher" ;
this . module = "Ciphers" ;
this . description = "Atbash is a mono-alphabetic substitution cipher originally used to encode the Hebrew alphabet. It has been modified here for use with the Latin alphabet." ;
2018-08-21 20:07:13 +02:00
this . infoURL = "https://wikipedia.org/wiki/Atbash" ;
2018-05-09 21:18:33 +02:00
this . inputType = "string" ;
this . outputType = "string" ;
this . args = [ ] ;
}
/ * *
* @ param { string } input
* @ param { Object [ ] } args
* @ returns { string }
* /
run ( input , args ) {
return affineEncode ( input , [ 25 , 25 ] ) ;
}
/ * *
* Highlight Atbash Cipher
*
* @ param { Object [ ] } pos
* @ param { number } pos [ ] . start
* @ param { number } pos [ ] . end
* @ param { Object [ ] } args
* @ returns { Object [ ] } pos
* /
highlight ( pos , args ) {
return pos ;
}
/ * *
* Highlight Atbash Cipher in reverse
*
* @ param { Object [ ] } pos
* @ param { number } pos [ ] . start
* @ param { number } pos [ ] . end
* @ param { Object [ ] } args
* @ returns { Object [ ] } pos
* /
highlightReverse ( pos , args ) {
return pos ;
}
}
export default AtbashCipher ;