1

С помощь чего можно делать bcryp хэш на android?

1 ответ 1

2

Например, есть библиотека jBcrypt:

// Hash a password for the first time
String hashed = BCrypt.hashpw(password, BCrypt.gensalt());

// gensalt's log_rounds parameter determines the complexity
// the work factor is 2**log_rounds, and the default is 10
String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));

// Check that an unencrypted password matches one that has
// previously been hashed
if (BCrypt.checkpw(candidate, hashed))
    System.out.println("It matches");
else
    System.out.println("It does not match");

Главное не забывать, что вычисление хеша довольно ресурсоёмкая операция, и не вычислять его в UI-thread.

1
  • Спасибо. Символы для публикации)
    – Icsdssd
    4 фев 2017 в 6:42

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.