NEP2 { public static String encrypt(String password, ECKeyPair ecKeyPair) throws CipherException { return encrypt(password, ecKeyPair, N_STANDARD, P_STANDARD, R_STANDARD); }  static ECKeyPair decrypt(String password, String nep2String); static ECKeyPair decrypt(String password, String nep2String, ScryptParams scryptParams); static String encrypt(String password, ECKeyPair ecKeyPair); static String encrypt(String password, ECKeyPair ecKeyPair, ScryptParams scryptParams); static String encrypt(String password, ECKeyPair ecKeyPair, int n, int p, int r); static byte[] performCipherOperation(
            int mode, byte[] data, byte[] encryptKey); static byte[] getAddressHash(ECKeyPair ecKeyPair); static final int DKLEN; static final int NEP2_PRIVATE_KEY_LENGTH; static final byte NEP2_PREFIX_1; static final byte NEP2_PREFIX_2; static final byte NEP2_FLAGBYTE; static final int N_STANDARD; static final int P_STANDARD; static final int R_STANDARD; static final ScryptParams DEFAULT_SCRYPT_PARAMS; }
@Test public void encryptWithDefaultScryptParams() throws CipherException { byte[] privKey = Numeric.hexStringToByteArray( "7fe9d4b69f85c1fe15387a76e79d2b95c4c9e3fe756de3435afbc077d99d5346"); String pw = "neo"; String expectedNep2Encrypted = "6PYLykbKcbwnCuTJiQQ5PYu5uH9NgwGYLoMyTUabRxRJUsiA9GP8NgorUV"; ECKeyPair keyPair = ECKeyPair.create(privKey); assertThat(NEP2.encrypt(pw, keyPair), is(expectedNep2Encrypted)); }
@Test public void encryptWithNonDefaultScryptParams() throws CipherException { ScryptParams nonDefaultScryptParams = new ScryptParams(256, 1, 1); byte[] privKey = Numeric.hexStringToByteArray( "7fe9d4b69f85c1fe15387a76e79d2b95c4c9e3fe756de3435afbc077d99d5346"); String pw = "neo"; String expected = "6PYLykbKbcpcZTuaSyTqBmauUkwVN4cQHjQAufT8y5YE6vCP44nxtf9r3P"; ECKeyPair keyPair = ECKeyPair.create(privKey); assertThat(NEP2.encrypt(pw, keyPair, nonDefaultScryptParams), is(expected)); }