Skip to content

Commit

Permalink
move kotlin files; rename DHKEBI_K
Browse files Browse the repository at this point in the history
  • Loading branch information
aburgd committed Jul 24, 2017
1 parent b302129 commit 9ac304c
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 373 deletions.
43 changes: 0 additions & 43 deletions src/DHKEBI.java

This file was deleted.

30 changes: 0 additions & 30 deletions src/DigestTools.java

This file was deleted.

47 changes: 0 additions & 47 deletions src/Generation.java

This file was deleted.

97 changes: 0 additions & 97 deletions src/LongOps.java

This file was deleted.

40 changes: 40 additions & 0 deletions src/kotlin/DHKEBI.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package kotlin

import org.apache.commons.codec.binary.Hex

import java.math.BigInteger
import java.util.Scanner

object DHKEBI {

private val stdin = Scanner(System.`in`)

@JvmStatic fun main(args: Array<String>) {
println("Enter an option and press Return/Enter:")
println("1) public key\n2) shared secret")

val answer = stdin.nextInt()

when (answer) {
1 -> {
val userPublicKey = Generation.publicKeyGeneration()
val userKeyDigest = DigestTools.getDigest(userPublicKey, "SHA")
val userKeyHex = Hex.encodeHexString(userKeyDigest)
System.out.printf("Your public key is:\n%d\n",
userPublicKey)
print("Your public key's digest is:\n")
DigestTools.digestPrinter(userKeyHex)
}
2 -> {
val userSharedSecret = Generation.sharedSecretGeneration()
val userSecretDigest = DigestTools.getDigest(userSharedSecret, "SHA")
val userSecretHex = Hex.encodeHexString(userSecretDigest)
System.out.printf("Your shared secret is:\n%d\n",
userSharedSecret)
print("Your shared secret's digest is:\n")
DigestTools.digestPrinter(userSecretHex)
}
else -> print("INVALID_ANS: Please enter 1 or " + "2")
}
}
}
Loading

0 comments on commit 9ac304c

Please sign in to comment.