Crypto::encode(3) Encode a String using the AES256 algorithm.


String encode( String msg )


msg The String to encode


Encode a String using the AES256 algorithm. The value is encoded with the application's secret key, which is compiled in automatically (unless overridden with Crypto.setEncryptionKey(3kaya) ). The return value is base64 encoded and also includes a hash which will be verified when the String is decoded. The value will only be decodable by the Kaya application that encoded it, provided that the application secret key is not revealed.

You must therefore ensure no-one has read access to the application key (whether this is in the Kaya binary or an external source) if you need to rely on the integrity of the data (for example, in CGI or webapps). Should you suspect the key is compromised, you can change an internal key by recompiling the binary, or using the kaya-rekey utility.


Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see


The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.