public abstract class Hasher extends Object implements com.oracle.labs.mlrg.olcut.config.Configurable, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, Serializable
Modifier and Type | Field and Description |
---|---|
static int |
MIN_LENGTH
The minimum length of the salt.
|
Constructor and Description |
---|
Hasher() |
Modifier and Type | Method and Description |
---|---|
abstract String |
hash(String input)
Hashes the supplied input using the hashing function.
|
abstract void |
setSalt(String salt)
The salt is transient, it must be set **to the same value as it was trained with**
after the
Model is deserialized. |
static boolean |
validateSalt(String salt)
Salt validation is currently a test to see if the string is longer than
MIN_LENGTH . |
public static final int MIN_LENGTH
public abstract String hash(String input)
input
- The input to hash.public abstract void setSalt(String salt)
Model
is deserialized.salt
- Salt value.public static boolean validateSalt(String salt)
MIN_LENGTH
.
When this method is updated Hasher must update it's serialVersionUID, this ensures that serialised instances of downstream classes which call this method are invalidated, as changes to validateSalt may invalidate old salts, and there is no other way to communicate this to the developer.
salt
- String to validate.Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.