/** * @return the length of the code */ public int getN() { return params.getN(); }
private void initCipherDecrypt(McEliecePrivateKeyParameters privKey) { n = privKey.getN(); k = privKey.getK(); maxPlainTextSize = (k >> 3); cipherTextSize = n >> 3; }
public void initCipherDecrypt(McEliecePrivateKeyParameters privKey) { n = privKey.getN(); k = privKey.getK(); maxPlainTextSize = (k >> 3); cipherTextSize = n >> 3; }
/** * Return the key size of the given key object. * * @param key the McElieceKeyParameters object * @return the keysize of the given key object */ public int getKeySize(McElieceKeyParameters key) { if (key instanceof McEliecePublicKeyParameters) { return ((McEliecePublicKeyParameters)key).getN(); } if (key instanceof McEliecePrivateKeyParameters) { return ((McEliecePrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * Return the key size of the given key object. * * @param key the McElieceKeyParameters object * @return the keysize of the given key object */ public int getKeySize(McElieceKeyParameters key) { if (key instanceof McEliecePublicKeyParameters) { return ((McEliecePublicKeyParameters)key).getN(); } if (key instanceof McEliecePrivateKeyParameters) { return ((McEliecePrivateKeyParameters)key).getN(); } throw new IllegalArgumentException("unsupported type"); }
/** * @return the hash code of this key */ public int hashCode() { int code = params.getK(); code = code * 37 + params.getN(); code = code * 37 + params.getField().hashCode(); code = code * 37 + params.getGoppaPoly().hashCode(); code = code * 37 + params.getP1().hashCode(); code = code * 37 + params.getP2().hashCode(); return code * 37 + params.getSInv().hashCode(); }
McEliecePrivateKey privateKey = new McEliecePrivateKey(params.getN(), params.getK(), params.getField(), params.getGoppaPoly(), params.getP1(), params.getP2(), params.getSInv()); PrivateKeyInfo pki; try