Kotlin Hashing

Hashing is an important concept, it has numerous applications, and it’s at the core of many other computer science concepts.

HashUtils.kt is a very simple, yet very helpful snippet I’ve used in some of my applications when I need some basic hashing. It’s an extension function, one of Kotlin neat features.

Usage:

val text = "hello"
val hashedText = text.hash(Algorithm.SHA256)

Reference:
https://www.samclarke.com/kotlin-hash-strings/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s