Crypto - internal module to handle cryptography



Initializes. It requires the configuration value aeskey.

$hash = Crypto::hash($data)

Returns the base64-encoded form of the SHA512 hash of the data.

$enc = Crypto::encrypt($plain)

Encrypts the plaintext, and returns a base64-encoded version of the encrypted version.

$plain = Crypto::decrypt($enc)

The argument is taken as a base64-encoded, AES-encrypted string. It is decoded and decrypted, the result is returned.

$sig = Crypto::sign($data)

This method returns a signature of the data. The signature is computed as an encrypted hash of the data.

$result = Crypto::validate($data, $sig)

Validates that the signature matches data. The decrypted signature must match the hash of the data.


This module is for internal use in the HammerServer.


The tamper-resistant server, all used modules, and the documentation were written by Karel Kubat / Copyright (c) 2009 ff. Distributed under GPLV3.