DEA128decrypt and DEA128encrypt (String functions): Difference between revisions
m (fix example) |
m (typo) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
</p> | </p> | ||
You can use <var>DEA128decrypt</var> to "document" that you are decrypting, and | You can use <var>DEA128decrypt</var> to "document" that you are decrypting, and | ||
use <var>DEA128encrypt</var> to "document" that you are | use <var>DEA128encrypt</var> to "document" that you are encrypting. You can use <var>DEA128decrypt</var> and <var>DEA128encrypt</var> interchangeably on the rest of this page. | ||
==Syntax== | ==Syntax== | ||
Line 40: | Line 40: | ||
%ls is longstring | %ls is longstring | ||
%string is longstring | %string is longstring | ||
%key is | %key is string len 16 | ||
%string = 'onetwothreefour0onetwothreefour0' | %string = 'onetwothreefour0onetwothreefour0' | ||
%key = '1234567816161616' | %key = '1234567816161616' | ||
Line 56: | Line 56: | ||
==See also== | ==See also== | ||
<ul> | <ul> | ||
<li>< | <li>Additional DEA methods: | ||
<ul> | |||
{{Template:DEA crypto methods}} | |||
</ul></li> | |||
<li>Additional two-way ciphers: | |||
<ul> | |||
{{Template:AES crypto methods}} | |||
<li>[[RC4decrypt and RC4encrypt (String functions)]]</li> | |||
</ul></li> | |||
<li><var>String</var> one-way ciphers: | |||
<ul> | |||
<li><var>[[MD5digest (String function)|MD5digest]]</var> </li> | |||
<li><var>[[SHAdigest (String function)|SHAdigest]]</var> </li> | |||
<li><var>[[SHA224digest (String function)|SHA224digest]]</var> </li> | |||
<li><var>[[ | <li><var>[[SHA256digest (String function)|SHA256digest]]</var> </li> | ||
</ul></li> | |||
</ul> | </ul> | ||
{{Template:String:DEA128decrypt and DEA128encrypt footer}} | {{Template:String:DEA128decrypt and DEA128encrypt footer}} |
Latest revision as of 20:51, 16 March 2016
DEA128 encryption or decryption (String class)
[Introduced in Model 204 7.6]
DEA128decrypt and DEA128encrypt are synonyms for the String class function that applies the DEA (Data Encryption Algorithm) using a 128-bit symmetric key to decrypt or encrypt each 64-bit block of input text. For more details about how the algorithm works, see Triple DES.
The length of the returned string is the same as that of the object string.
DEA is a two-way cipher, so encrypting a string with a key and then decrypting the result of that encryption with the same key produces the original string. That is, the following assertion should always hold:
assert %string:dea128encrypt(%key):dea128decrypt(%key) eq %string
You can use DEA128decrypt to "document" that you are decrypting, and use DEA128encrypt to "document" that you are encrypting. You can use DEA128decrypt and DEA128encrypt interchangeably on the rest of this page.
Syntax
%outString = string:DEA128decrypt( key) Throws UnsupportedCrypto, InvalidCryptoKey, InvalidCryptoData
%outString = string:DEA128encrypt( key) Throws UnsupportedCrypto, InvalidCryptoKey, InvalidCryptoData
Syntax terms
%outString | A string variable to receive the encrypted or decrypted method object string. Its length is the same as string. |
---|---|
string | The string to which the method is applied. string must be a multiple of eight bytes in length; its maximum is 32768 bytes. It may be null. |
key | A 16-byte (only) string variable whose value is used to encrypt or decrypt the method object, string. |
Usage notes
- You are not prevented from creating confusion by encrypting with DEA128decrypt and decrypting with DEA128encrypt.
- The DEA128decrypt and DEA128encrypt functions are available as of Model 204 7.6.
Examples
In the following example, the output string from the DEA128encrypt method is converted to hex using the StringToHex function to reveal its non-displayable characters, then decrypted to return the original input string:
b %ls is longstring %string is longstring %key is string len 16 %string = 'onetwothreefour0onetwothreefour0' %key = '1234567816161616' %ls = %string:dea128encrypt(%key) printText {~} is {%ls:stringTohex} printText {~} is: {%ls:dea128decrypt(%key)} end
The result is:
%ls:stringTohex is: 07A6F72D733C4A333DCB4A8F9661AC8307A6F72D733C4A333DCB4A8F9661AC83 %ls:dea128decrypt(%key) is: onetwothreefour0onetwothreefour0
See also
- Additional DEA methods:
- DEA64decrypt and DEA64encrypt (String functions)
- DEA128decrypt and DEA128encrypt (String functions)
- DEA192decrypt and DEA192encrypt (String functions)
- DEA64CBCdecrypt and DEA64CBCencrypt (String functions)
- DEA128CBCdecrypt and DEA128CBCencrypt (String functions)
- DEA192CBCdecrypt and DEA192CBCencrypt (String functions)
- Additional two-way ciphers:
- AES128decrypt and AES128encrypt (String functions)
- AES192decrypt and AES192encrypt (String functions)
- AES256decrypt and AES256encrypt (String functions)
- AES128CBCdecrypt and AES128CBCencrypt (String functions)
- AES192CBCdecrypt and AES192CBCencrypt (String functions)
- AES256CBCdecrypt and AES256CBCencrypt (String functions)
- RC4decrypt and RC4encrypt (String functions)
- String one-way ciphers: