Fix QLDocs and the qhelp example

This commit is contained in:
Tony Torralba
2021-09-03 14:10:15 +02:00
parent f0604e2e84
commit 16b61f78e6
3 changed files with 19 additions and 0 deletions

View File

@@ -16,3 +16,12 @@ public void sqlCipherStorageSafe(String name, String password, String databasePa
net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase("test", databasePassword, null);
db.execSQL("INSERT INTO users VALUES (?, ?)", new String[] {name, password});
}
private static String encrypt(String cleartext) {
// Use an encryption or strong hashing algorithm in the real world.
// The example below just returns a SHA-256 hash.
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(cleartext.getBytes(StandardCharsets.UTF_8));
String encoded = Base64.getEncoder().encodeToString(hash);
return encoded;
}