Search in sources :

Example 1 with Blake3Parameters

use of com.github.zhenwei.core.crypto.params.Blake3Parameters in project LinLong-Java by zhenwei1108.

the class Blake3Mac method init.

public void init(final CipherParameters pParams) {
    CipherParameters myParams = pParams;
    if (myParams instanceof KeyParameter) {
        myParams = Blake3Parameters.key(((KeyParameter) myParams).getKey());
    }
    if (!(myParams instanceof Blake3Parameters)) {
        throw new IllegalArgumentException("Invalid parameter passed to Blake3Mac init - " + pParams.getClass().getName());
    }
    final Blake3Parameters myBlakeParams = (Blake3Parameters) myParams;
    if (myBlakeParams.getKey() == null) {
        throw new IllegalArgumentException("Blake3Mac requires a key parameter.");
    }
    /* Configure the digest */
    theDigest.init(myBlakeParams);
}
Also used : CipherParameters(com.github.zhenwei.core.crypto.CipherParameters) Blake3Parameters(com.github.zhenwei.core.crypto.params.Blake3Parameters) KeyParameter(com.github.zhenwei.core.crypto.params.KeyParameter)

Aggregations

CipherParameters (com.github.zhenwei.core.crypto.CipherParameters)1 Blake3Parameters (com.github.zhenwei.core.crypto.params.Blake3Parameters)1 KeyParameter (com.github.zhenwei.core.crypto.params.KeyParameter)1