File: Library_Crypto.c

package info (click to toggle)
openclonk 8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 169,520 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (19 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Experimental cryptographic function library.
 * Contains a lot less stuff than you expect. May also change at any time.
 */

// I'm choosing to implement it this way because this means we can change the
// underlying implementation without having to give too much consideration to
// existing scripts. You shouldn't use the native functions in _Crypto directly
// because we might change them if necessary; the current implementation of 
// engine-provided libraries is VERY experimental and might not survive in its
// current form.
static const Crypto = new _Crypto
{
	/**
	 * Calculates a cryptographically secure hash over [data]. Will return an
	 * encoded string safe for embedding in a script without further escaping.
	 */
	ComputeHash = func(string data) { return _ComputeHash(data, 25); }
};