-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(java): android: hash token and video id for workmanager API
- Loading branch information
1 parent
9559f04
commit 6539d91
Showing
2 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package video.api.client.api.work.utils | ||
|
||
import java.security.MessageDigest | ||
|
||
fun String.md5(): String { | ||
return hashString(this, "MD5") | ||
} | ||
|
||
private fun hashString(input: String, algorithm: String): String { | ||
return MessageDigest | ||
.getInstance(algorithm) | ||
.digest(input.toByteArray()) | ||
.fold("") { str, it -> str + "%02x".format(it) } | ||
} |