Skip to content

Autokey Encryption is not there in this. #32

Open

Description

@GameEntity903

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.

Activity

  1. Chunjee commented on Dec 27, 2022

    @Chunjee

    https://en.wikipedia.org/wiki/Autokey_cipher

    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.

  2. GameEntity903 commented on Dec 28, 2022

    @GameEntity903
    Author

    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
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions