parent
5e9b8adc8b
commit
9a5ceb0c3a
@ -1,14 +0,0 @@
|
|||||||
package com.example.what_the_fantasy.ui.components
|
|
||||||
|
|
||||||
import java.security.MessageDigest
|
|
||||||
|
|
||||||
fun hashPassword(password: String): String {
|
|
||||||
// SHA-256
|
|
||||||
val digest = MessageDigest.getInstance("SHA-256")
|
|
||||||
|
|
||||||
// Convertir mdp en bytes et appliquer le hash
|
|
||||||
val hashedBytes = digest.digest(password.toByteArray())
|
|
||||||
|
|
||||||
// Convertir le tableau de bytes en une chaîne hexadécimale
|
|
||||||
return hashedBytes.joinToString("") { "%02x".format(it) }
|
|
||||||
}
|
|
Loading…
Reference in new issue