Computer scienceProgramming languagesKotlinAdditional instrumentsCryptography and encoding

Hashing and security

Theory

Hashing a password in Kotlin

Report a typo

Complete the method fun hashPassword(password: String): String to return the SHA-256 hash for the password parameter.

Sample Input 1:

Secret

Sample Output 1:

7e32a729b1226ed1270f282a8c63054d09b26bc9ec53ea69771ce38158dfade8
Write a program in Kotlin
import java.security.MessageDigest

fun hashPassword(password: String): String {
// write your code here
}

Create a free account to access the full topic