Code Monkey home page Code Monkey logo

libcrypt.ahk's People

Contributors

abc905 avatar g33kdude avatar hi5 avatar joedf avatar masonjar13 avatar mmikeww avatar neurofunk avatar nnnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libcrypt.ahk's Issues

FIX: LC_UrlEncode differs from JavaScript implementation

Not a big deal, just differs from the standard (in my case caused a little conflict). RegEx parameter should be [!#$&-;=?-Z_a-z~] in

return LC_UriEncode(Url, "[0-9a-zA-Z:/;?@,&=+$#.]")

Rationale:

In ascii-code.com a more visual representation is found, however getting a list of all the non-control ASCII chars:

i := 33, s :=
While (i < 127)
    s .= Chr(i++)
/* Result:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
*/

And in a JavaScript console:

// Escaped: Single quote and Backslash
uri = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
enc = encodeURI(uri);
dec = decodeURI(enc);
console.log(enc)
console.log(dec)

Removing the encoded chars leaves the list provided as RegEx. Hope it helps someone.

LC_UriDecode breaks on %25

For example, LC_UriDecode("%2534") returns 4 instead of %34. I've written a version of the function that doesn't have that problem, but it's roughly 2x slower by my benchmarks.

UriDecode(Uri)
{
    VarSetCapacity(Out, StrLen(Uri)+1, 0), Ptr := &Out, i := 1
    While Char := SubStr(Uri, i++, 1)
        NumPut(Char=="%"?"0x" SubStr(Uri,-2+i+=2,2):Asc(Char),Ptr++,"UChar")
    Return, StrGet(&Out, "UTF-8")
}

libcrypt.ahk : Distribution

Currently, it is built with make.ahk. should be have an installer, be a pacakge or be a template?
This is the follow-up conversation started here : #13

Function usage document as comments

The function usage should have a standard format of documentation as a short comment over each function in its lib file.

Suggested format:

Description : [tab] ...
Usage : [tab] param1 - the input string to be ...
[tab] [tab?] param2 - ...

Thoughts?

Which Encryption to choose?

I'm planning on adding some Encryption/Decryption to my Lintalist program as a plugin but I'm not sure which encryption to use. I have a working example with RC4 and nnnik21 by @nnnik - but there is also AES by @jNizM which may not be fully ready yet(?):

RC4 isn't very secure as far as I know so I'll scratch that one.

Changing the encryption used at a later stage could be annoying as the user would have to run a conversion script to go from one encryption to the new one so I'd rather pick one and stick with it.

Collection of functions & libs v one big stdlib

Should this repo become a collection of individual functions and libraries OR should all crypting functions be included into one bigger stdlib compatible library?

Base64.ahk
Rot13.ahk
etc

vs

LC_Base64_*
LC_Rot13
etc

Autokey Encryption is not there in this.

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.

Vigenere Cipher being incorrect

LC_VigenereCipher("Testingabc","Lemon") gives a result of "EOKNBYQSVV" which is supposed to be "Eiehvykmpp" and using LC_VigenereDecipher(LC_VigenereCipher("Testingabc","Lemon"),"Lemon") gives a result of "TE9:/NGABC" which is supposed to be "Testingabc" in the ideal scenario, but since there is an error somewhere in the encrypting process, the output should be "TKYZONMGHI" when the Input to the decipher function is "EOKNBYQSVV".
https://ciphereditor.com/ to verify

Should I add my UriEncode/Decode functions?

specifically these

; Modified by GeekDude from http://goo.gl/0a0iJq
UriEncode(Uri)
{
    VarSetCapacity(Var, StrPut(Uri, "UTF-8"), 0), StrPut(Uri, &Var, "UTF-8")
    f := A_FormatInteger
    SetFormat, IntegerFast, H
    While Code := NumGet(Var, A_Index - 1, "UChar")
        If (Code >= 0x30 && Code <= 0x39 ; 0-9
            || Code >= 0x41 && Code <= 0x5A ; A-Z
    || Code >= 0x61 && Code <= 0x7A) ; a-z
    Res .= Chr(Code)
    Else
        Res .= "%" . SubStr(Code + 0x100, -1)
    SetFormat, IntegerFast, %f%
    Return, Res
}

UriDecode(Uri)
{
    Pos := 1
    While Pos := RegExMatch(Uri, "i)(%[\da-f]{2})+", Code, Pos)
    {
        VarSetCapacity(Var, StrLen(Code) // 3, 0), Code := SubStr(Code,2)
        Loop, Parse, Code, `%
            NumPut("0x" A_LoopField, Var, A_Index-1, "UChar")
        StringReplace, Uri, Uri, `%%Code%, % StrGet(&Var, "UTF-8"), All
    }
    Return, Uri
}

The indentation might be a little bit funny, but that's because of AHK Studio's Auto-Indent not picking up on multiline if statements.

install.ahk

Would anybody mind if I made a script "install.ahk" in the root that automatically copied the latest build to %A_WorkingDir%\AutoHotkey\lib? And if I do make an installer, should it automatically run make before copying?

SHA-2 in Readme

  • SHA-1
  • SHA-2
  • SHA-256, SHA-384, SHA-512

==>

  • SHA-1
  • SHA-2 (SHA-256, SHA-384, SHA-512)

RC4 via WinAPI?

Anyone know where I can find an RC4 algo using the WinCryptoApi? I'm currently using Laszlo's which looks similar to the one in this repo. But both are dependent upon SetFormat which is removed in AHK v2. So I'm hoping for a quick link to an algo using the win api but still encrypts to hex...

What is UrlEncode for?

I'm not sure what that seemingly complicated RegEx filled function is for. Can someone explain?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.