| FrontBack |
| | Nuova Versione! v1.3.5 build 2 Eccomi qua, a riproporre questo programma in versione alleggerita (senza GUI) e personalizzabile... vi presento la WEPA Encryption UDF! Ecco il codice: CODICE #include-once #include-once ;####################### ;# WEPA Encryption UDF # ;#Version 1.3.5 build 2# ;####################### #include <String.au3> #include <XXTEA.au3> #include <StaticConstants.au3> #include <Base64.au3> #include <RC4.au3> ; Function: _WEPAEncrypt ; Parameters: $String = Insert string to encrypt ; $EncryptionPassword = Insert password to use ; $EncryptionLevel = Insert level to final encryption (from 1 to 10) ; $ASCII = If sets True, crypt in ANSI ; $UTF8 = If sets True, crypt in UTF8 ; $XXTEA = If sets True, crypt in XXTEA ; $Base64 = If sets True, crypt in Base64 ; $RC4 = If sets True, crypt in RC4 ; $HEX = If sets True, crypt in HEX ; Errors: ErrorCode 1 = Encryption failed ; Errors: ErrorCode 2 = Invalid Value Func _WEPAEncrypt($String, $EncryptionPassword, $EncryptionLevel, $ANSI, $UTF8, $XXTEA, $Base64, $RC4, $HEX) If ($ANSI = True Or $ANSI = False) And ($UTF8 = True Or $UTF8 = False) And ($XXTEA = True Or $XXTEA = False) And ($Base64 = True Or $Base64 = False) And ($RC4 = True Or $RC4 = False) And ($HEX = True Or $HEX = False) Then If $ANSI = True Then $String = stringToBinary($String) ElseIf $ANSI = False Then ConsoleWrite("WEPA Encryption UDF Output: Not ANSI") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $UTF8 = True Then $String = stringToBinary($String, 4) ElseIf $UTF8 = False Then ConsoleWrite("WEPA Encryption UDF Output: Not UTF-8") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $XXTEA = True Then $String = _XXTEA_Encrypt($String,$EncryptionPassword) ElseIf $XXTEA = False Then ConsoleWrite("WEPA Encryption UDF Output: Not XXTEA") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $Base64 = True Then $String = _Base64Encode($String) ElseIf $Base64 = False Then ConsoleWrite("WEPA Encryption UDF Output: Not Base64") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $RC4 = True Then $String = _RC4($String,$EncryptionPassword) ElseIf $RC4 = False Then ConsoleWrite("WEPA Encryption UDF Output: Not RC4") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $HEX = True Then $String = _StringEncrypt(1,$String,$EncryptionPassword,$EncryptionLevel) ElseIf $HEX = False Then ConsoleWrite("WEPA Encryption UDF Output: Not HEX") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf Return $String Else SetError(1) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 1") EndIf EndFunc ; Function: _WEPADecrypt ; Parameters: $String = Insert string to encrypt ; $EncryptionPassword = Insert password to use ; $EncryptionLevel = Insert level to final encryption (from 1 to 10) ; $ASCII = If sets True, decrypt in ANSI ; $UTF8 = If sets True, decrypt in UTF8 ; $XXTEA = If sets True, decrypt in XXTEA ; $Base64 = If sets True, decrypt in Base64 ; $RC4 = If sets True, decrypt in RC4 ; $HEX = If sets True, decrypt in HEX ; Errors: ErrorCode 1 = Encryption failed ; Errors: ErrorCode 2 = Invalid Value ; Notes: For a correct decryption, is necessary to repeat the identic values used for encryption Func _WEPADecrypt($String, $EncryptionPassword, $EncryptionLevel, $ANSI, $UTF8, $XXTEA, $Base64, $RC4, $HEX) If ($ANSI = True Or $ANSI = False) And ($UTF8 = True Or $UTF8 = False) And ($XXTEA = True Or $XXTEA = False) And ($Base64 = True Or $Base64 = False) And ($RC4 = True Or $RC4 = False) And ($HEX = True Or $HEX = False) Then If $HEX = True Then $String = _StringEncrypt(0,$String,$EncryptionPassword,$EncryptionLevel) ElseIf $HEX = False Then ConsoleWrite("WEPA Encryption UDF Output: Not ANSI") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $RC4 = True Then $String = _RC4($String,$EncryptionPassword) $String = BinaryToString($String) ElseIf $RC4 = False Then ConsoleWrite("WEPA Encryption UDF Output: Not RC4") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $Base64 = True Then $String = _Base64Decode($String) $String = BinaryToString($String) ElseIf $Base64 = False Then ConsoleWrite("WEPA Encryption UDF Output: Not Base64") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $XXTEA = True Then $String = _XXTEA_Decrypt($String,$EncryptionPassword) ElseIf $XXTEA = False Then ConsoleWrite("WEPA Encryption UDF Output: Not XXTEA") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $UTF8 = True Then $String = BinaryToString($String, 4) ElseIf $UTF8 = False Then ConsoleWrite("WEPA Encryption UDF Output: Not UTF-8") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf If $ANSI = True Then $String = BinaryToString($String) ElseIf $ANSI = False Then ConsoleWrite("WEPA Encryption UDF Output: Not ANSI") Else SetError(2) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 2") EndIf Return $String Else SetError(1) ConsoleWrite("WEPA Encryption UDF Output: ErrorCode 1") EndIf EndFunc Istruzioni:Per criptare un testo, inserisci così: _WEPAEncrypt(<testo da criptare>, <password di criptatura>, <livello di criptatura>, <attiva/Disattiva ANSI>, <attiva/Disattiva UTF-8>, <attiva/Disattiva XXTEA>, <attiva/Disattiva Base64>, <attiva/Disattiva RC4>, <attiva/Disattiva HEX>) Per decriptare correttamente è necessario inserire la stessa password, lo stesso livello di criptatura e i vari algoritmi inseriti devono essere gli stessi usati nella criptatura: _WEPADecrypt(<testo da decriptare>, <password di criptatura>, <livello di criptatura>, <attiva/Disattiva ANSI>, <attiva/Disattiva UTF-8>, <attiva/Disattiva XXTEA>, <attiva/Disattiva Base64>, <attiva/Disattiva RC4>, <attiva/Disattiva HEX>) Per attivare/disattivare un algoritmo inseire True/False Codici di errore ritornati:1 = Errore nella cifratura/decifratura 2 = Parametri non validi (diversi da True/False) NB.: Se vi capitano degli errori, andate a dormire che per voi non è giornata, perchè è quasi IMPOSSIBILE che la funzione ne segnali uno! L'uso è concesso liberamente anche non citando l'autore. Se trovate bug, ditemelo! Edited by FrontBack - 8/11/2010, 22:05
| | |
| |
|