# decrypt

Decrypt a value with an algorythm.

# DECRYPT

## NAME

decrypt - Decrypts a value with an algorythm.

## SYNOPSIS

decrypt(key:12345678,value:"123"[,algo:blowfish,error:var])

## PARAMETERS

Encryption key value
The encrypted value the user wants to decrypt.

Encryption algorithm
The algorithm used for the encryption. By default, the used algorithm is Blowfish. It supports cast5, aes, aes192, twofish128, des(not secure).

Error
If the user specified an error variable, then this variable will contain "errorcode" or "errmsg". If the "errorcode" is not zero, then there is an error.

## RETURN

Returns decrypted string, array, context or null.

## EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

```res={_{a=crypt(value:"Pierre",key:'1234567890123456',iv:"1234567890123456");
a;
decrypt(value:a,key:"1234567890123456",iv:"1234567890123456")}}.
return res=Vyykaa4u9cg=Pierre.

res={_{a=crypt(value:"Pierre",key:'1234567890123456');
decrypt(value:a,key:"1234567890123456")}}. return res=Pierre.

res={_{a=crypt(value:[1,2,3],key:'1234567890123456');
decrypt(value:a,key:"1234567890123456")}}. return res=\[1,2,3].

res={_{a=crypt(value:{"a":1,"b":"c"},key:'1234567890123456');
decrypt(value:a,key:"1234567890123456")}}. return res=\{"a":1,"b":"c"}.

res={_{a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456');
decrypt(value:a,key:"1234567890123456")}}. return res=\{"a":1,"b":\[1.2,"c"]}.

res={_{a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456',algo:"cast5");
decrypt(value:a,key:"1234567890123456",algo:"cast5")}}.
return res=\{"a":1,"b":\[1.2,"c"]}.

res={_{a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456',algo:"twofish128");
decrypt(value:a,key:"1234567890123456",algo:"twofish128")}}.
return res=\{"a":1,"b":\[1.2,"c"]}.

res={_{
a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456',algo:"twofish128");
decrypt(error:e,value:'a',key:"1234567890123456",algo:"twofish128");
e;
}}. return res=.*decode.*.

res={_{
a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456',algo:"twofish128");
decrypt(value:'a',key:"1234567890123456",algo:"twofish128");
e;
}}. return .*decode.*

res={_{a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456',algo:"aes192");
decrypt(value:a,key:"1234567890123456",algo:"aes192")}}. return res=\{"a":1,"b":\[1.2,"c"]}.

res={_{a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'12345678',algo:"des");
decrypt(value:a,key:"12345678",algo:"des")}}. return res=\{"a":1,"b":\[1.2,"c"]}.

res={_{
a=crypt(error:e,value:{"a":1,"b":[1.2,"c"]},key:'1345678',algo:"des");
e;
}}. return res=.*Failed setting the key.*.

res={_{a=crypt(value:{"a":1,"b":[1.2,"c"]},key:'1234567890123456',algo:"x3des");
decrypt(value:a,key:"1234567890123456",algo:"3des")}}. return .*This algorithm.*
```