You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on one method to do it. I noticed that all other major cryptography functions were there but not this. That's all I have to say. P.S. Decoding is much harder than encoding.
An autokey cipher (also known as the autoclave cipher) is a cipher that incorporates the message (the plaintext) into the key. The key is generated from the message in some automated fashion, sometimes by selecting certain letters from the text or, more commonly, by adding a short primer key to the front of the message.
There are two forms of autokey cipher: key-autokey and text-autokey ciphers. A key-autokey cipher uses previous members of the keystream to determine the next element in the keystream. A text-autokey uses the previous message text to determine the next element in the keystream.
Activity
Chunjee commentedon Dec 27, 2022
https://en.wikipedia.org/wiki/Autokey_cipher
GameEntity903 commentedon Dec 28, 2022
Encoding and Decoding functions. No idea whether this is fully optimized or not.
AutoKeyEnc(Primer,Input) ;GameNtt
{
alphacount := 0
spacecount := 0
spacecount2 := 0
Loop, Parse, Input
{
chint := Asc(A_LoopField)
if(((chint >= 65) && (chint <= 90)) || ((chint >= 97) && (chint <= 122)))
alphacount++
else if(chint == 32)
{
spacecount++
if(A_Index > (StrLen(Input)-StrLen(Primer)))
spacecount2++
}
}
alphacount := alphacount - StrLen(Primer)
totalcount := alphacount + spacecount - spacecount2
Return Vigenere((Primer . SubStr(Input, 1, totalcount)),Input)
}
AutoKeyDec(Primer,Input) ;GameNtt
{
Inlen := StrLen(Input)
PrimerLen := StrLen(Primer)
Primer2 := Primer
Primer2Len := StrLen(Primer2)
nofloops := (Inlen//PrimerLen)+1
Loop, %nofloops%
{
output := VigenereDec(Primer2,(SubStr(Input,1,Primer2Len)))
Primer2 := Primer . output
Primer2Len := StrLen(Primer2)
}
Return output
}