Untitled
unknown
kotlin
3 years ago
791 B
5
Indexable
package com.cookpad.hiring.android.utils import java.math.BigInteger import java.security.MessageDigest import java.sql.Timestamp object MarvelAuthentication { const val apiKey = "b556f9b742a9abe181548152db93ca06" // Public key private const val privateKey = "fd60114c9024499fde3846ff09a5a0adb54a3889" // Private key private var timestamp = Timestamp(System.currentTimeMillis()).time.toString() fun getTimestamp(): String { timestamp = Timestamp(System.currentTimeMillis()).time.toString() return timestamp } fun getHash(): String { val input = "$timestamp$privateKey$apiKey" val md = MessageDigest.getInstance("MD5") return BigInteger(1, md.digest(input.toByteArray())) .toString(16).padStart(32, '0') } }
Editor is loading...