PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 23 → WX - CryptStandart e UncryptStandart
WX - CryptStandart e UncryptStandart
Débuté par BOLLER, 16 mar. 2018 14:16 - 1 réponse
Membre enregistré
2 864 messages
Popularité : +89 (91 votes)
Posté le 16 mars 2018 - 14:16
CryptStandart e UncryptStandart

//Exemplo para Criptografar
sMessage is Buffer = "Message to encrypt"
bufKey is Buffer = HashString(HA_CKSUM_64, "password")
bufEncrypt is Buffer = CryptStandard(sMessage, bufKey, cryptDES)

Info(bufEncrypt)

// Exemplo para Decriptografar
bufKey is Buffer = HashString(HA_CKSUM_64, "password")
sResult is Buffer = UncryptStandard(bufEncrypt, bufKey, cryptDES)

Info(sResult)



//E no Windev Mobile
//Criptografia
B_senha is Buffer = HashString(HA_HMAC_MD5_128, "bob-esponja")
B_resultado_Criptografado is Buffer = CryptStandard(buf_conteudo_sig, B_senha, cryptAES128)

Info(B_resultado_Criptografado)


//Descriptografia
B_senha is Buffer = HashString(HA_HMAC_MD5_128, "bob-esponja")
B_resultado_Descriptografado is Buffer = UncryptStandard(buf_conteudo_sig, B_senha, cryptAES128)

Info(B_resultado_Descriptografado )


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
226 messages
Posté le 22 mars 2018 - 21:08
Hi

I use this function but it doesn't work pefectly between Android and PC for some reason.

Have you had that issue too?

I'm using windev mobile 20 and Windev 20 my text it's an Unicode String for both sides but it only uncrypt the first letter the rest is lost

heres my code:

//Encrypt in Android
pass is UNICODE string = "Password"
bufKEY is Buffer = HashString(HA_MD5_128,pass)
sMessa is UNICODE string = EDT_Text
bufEncrypt is Buffer = CryptStandard(sMessa,bufKEY,cryptAES128)

TableDB.Pa = bufEncrypt
HAdd(TableDB)
Info("Done")



//Uncrypt on PC
HReadFirst(TableDB,ID)
pass is UNICODE string = "Password"
bufkey is Buffer= HashString(HA_MD5_128,pass)
bufSResult2 is Buffer = UncryptStandard(TablaErrores.Pa,BufKey,cryptAES128)
EDT_Uncrypt= bufSResult2

IF bufSResult2 = "" THEN
Info(ErrorInfo(errFullDetails))
END