-
Notifications
You must be signed in to change notification settings - Fork 0
User's Guide & How it works
The cryptographic procedures are based on geometrical principles, the algorithms of which I've came up with and developed myself.
The mentioned geometrical point-converting mechanism provides a way to assign a single unique value to every point in an N-dimensional system.
The resulting value depends on what base is used. Exceptions are points, of which only the X coordinate is non-zero and below half of the base used, e.g. point with coordinates (0,0,0,4) will serialize into "4" for all the bases above 7.
Similarly, each value has exactly one corresponding point in any given "number-of" dimensional coordinate system, of which the location depends on the base used in the conversion procedure.
Unify - Serialize many numbers (an N-dimensional point) into a single value, according to the base used.
Resolve - Partialize a value, given the number of dimensions and the base at which to vectorize. Backward operation for Unify.
Direct Convert - Refers to a composite operation, which is used in the provided encryption system. Performs both of the above operations using two different bases and the amount of dimensions provided.
Base - Also called "level", sometimes "key". An unsigned 64 bit integer. A number from 3 to 2^64, used in the above operations.
nDimensions - also called "nDims" or "nD" in the source code. Number of dimensions in the coordinate system, used by the above operations. Recommended values are below 300.
| GUI term | Library function name | Description |
|---|---|---|
| Unify | ToNumber | Serializes the provided amount of numbers into a single number |
| Resolve | ToPointND | The reverse operation |
| Direct Convert | DirectConvert | Performs ToPointND(base1), then ToNumber(base2), with given arguments for nDimensions and the two bases |
| /// | Encrypt/Decrypt | Please see the descriptions in the next section below. |
Usable functions in NumLab.js involve:
- ToNumber() returns a signed BigInt. Converts (combines/unifies/wraps) an array of signed _BigInt_s into one single BigInt. Usage example in index.html -> "Unify" button
- ToPointND() is the reverse operation. It resolves (vectorizes/unwraps/decomposes) one signed BigInt into several signed BigInts. Example in index.html -> "Resolve" button
- DirectConvert() performs ToPointND() on a signed BigInt, then ToNumber() n the resulting array, based on given two "levels" (or bases/keys) and the number of dimensions. Example in index.html -> "Direct Convert" button
- DirectConvertArray8 which performs the actual encryption and decryption of a byte array. Used in uncrunchable.js.
- DirectConvertArray32 performs the actual encryption on an Uint32Array ignoring the elements with value 0 at the end. Used in uncrunchable.js.
uncrunchable.js exposes two functions:
- Encrypt() converts a byte array or an 'Uint32Array' into a BigInt, then performs DirectConvert(). Described and used in TestCrypt.html.
- Decrypt() is the same operation, but with exchanged "levels".
-
Since byte arrays are treated as numbers, leading zero-bytes cannot be "recognized", resulting in the following adjustment that I made: If the byte array finishes with zero-bytes, these zero-bytes will be copied to the end of the resulting byte array. If you don't want the zero-bytes at the end of array exposed, you should handle the array accordingly, prior to encryption.
-
For the "nDimensions" argument, please use values below 300, otherwise it may result in a prolonged processing of the encryption of larger byte arrays.