WEPA Encryption UDF

« Older   Newer »
  Share  
FrontBack
CAT_IMG Posted on 14/10/2010, 14:08     +1   -1




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:
SPOILER (click to view)
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! :P

L'uso è concesso liberamente anche non citando l'autore.

Se trovate bug, ditemelo! ;)

Edited by FrontBack - 8/11/2010, 22:05
 
Top
Aaly
CAT_IMG Posted on 8/11/2010, 19:43     +1   -1




Carina, bravo
 
Top
FrontBack
CAT_IMG Posted on 8/11/2010, 20:03     +1   -1




grazie :)
 
Top
xMasteRx
CAT_IMG Posted on 8/11/2010, 21:17     +1   -1




L'hai fatta te? [sono pigro di leggere tutto XD]
Se si, bravo e grazie :D
Se no, grazie ancora perché è utile lo stesso XD
 
Top
FrontBack
CAT_IMG Posted on 8/11/2010, 21:51     +1   -1




fatta io basandomi sul mio WEPA Encryption Tool.
l'ho semplicemente "adattato" ad una UDF ;)

Bug poco importante, ma ci tenevo a metterlo:

se non si mette true o false quando si sceglie un livello di criptatura ma si mette per esempio "a", la criptatura con il valore "a" verrà saltata
 
Top
xMasteRx
CAT_IMG Posted on 8/11/2010, 21:54     +1   -1




Bravo allora, niente male :D
 
Top
FrontBack
CAT_IMG Posted on 8/11/2010, 22:11     +1   -1




Nuova versione! v1.3.5 build 2



Novità
1. La funzione di controllo della sintassi è migliorata
2. Aggiunto un nuovo errore (di conversione)
3. Aggiornata guida nello script

Prossime Novità
1. Nuovo sistema di criptazione facilitato e velocizzato
2. Errori che appariranno -_-
3. Debug su console migliorato (se me lo facesse vedere...)
4. Nuovo Algoritmo veloce (SSEA, Super String Encryption Algorythm) (75%, testing)
5. Applicarla a miei futuri software

Vi aggiornerò su cosa succede dietro le quinte... ;)

Edited by FrontBack - 10/11/2010, 17:42
 
Top
FrontBack
icon13  CAT_IMG Posted on 10/11/2010, 17:56     +1   -1




La nuova versione è prossima al rilascio!

Versione: 1.5.1 build ?? (forse 22)
Novità
1. Nuovissimo algoritmo invantato da me basato sull'inversione dei caratteri (l'ho chiamata così!), chiamato SSEA (Super String Encryption Algorythm)

75% - Testing


2. Informazioni di debug in uscita in console che riporta lo stato prima della conversione

0% - Da iniziare


3. Errori esistenti

0% - Da iniziare


4. Velocizzazione del sistema di criptatura/decriptatura

0% - Da iniziare


5. Pulizia del codice

5% - Da continuare


6. Possibilità di integrare la funzione in una Progress Bar

0% - Da iniziare


7. Debug avanzato opzionale

0% - Da iniziare


Il codice si allungherà vertigginosamente...
ma chissene frega! ^_^
 
Top
Aaly
CAT_IMG Posted on 30/11/2010, 18:21     +1   -1




Bene =) buon lavoro
 
Top
8 replies since 14/10/2010, 14:08   152 views
  Share