Constructor
# new Hashing()
A utility class that provides a registry for different hashing functions and methods to hash objects. The class maintains a cache of registered hashing functions and allows setting a default hashing method. It prevents direct instantiation and provides static methods for registration and hashing.
Manages hashing methods and provides a unified hashing interface
Example
```typescript
// Register a custom hashing function
Hashing.register('md5', (obj) => createMD5Hash(obj), true);
// Hash an object using default method
const hash1 = Hashing.hash(myObject);
// Hash using specific method
const hash2 = Hashing.hash(myObject, 'md5');
```
Methods
# static register(key) → {void}
Adds a new hashing function to the registry. Optionally sets it as the default method. Throws an error if a method with the same key is already registered.
Registers a new hashing function
Parameters:
Name | Type | Description |
---|---|---|
key |
string
|
The identifier for the hashing function |
void