PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 25 → WX - CryptStandart e UncryptStandart
WX - CryptStandart e UncryptStandart
Iniciado por BOLLER, mar., 16 2018 2:16 PM - 1 resposta
Membro registado
3.651 mensagems
Popularité : +175 (223 votes)
Publicado em março, 16 2018 - 2:16 PM
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/
Membro registado
498 mensagems
Popularité : +8 (8 votes)
Publicado em março, 22 2018 - 9:08 PM
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