Yet Another OTP generator
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Totp.kt 520B

1234567891011
  1. package com.chameth.yaotp.algos
  2. import java.nio.ByteBuffer
  3. fun totp(key: ByteArray, startTime: Long = 0, step: Int = 30, currentTime: Long = currentTime(), length: Int = 6) = hotp(key, count(startTime, step, currentTime).toByteArray(), length)
  4. internal fun count(startTime: Long, step: Int, currentTime: Long) = (currentTime - startTime) / step
  5. internal fun currentTime() = System.currentTimeMillis() / 1000
  6. internal fun Long.toByteArray() = ByteBuffer.allocate(java.lang.Long.BYTES).putLong(this).array()