Skip to content

XTEA algorithm and CBC mode of operation implementations in Scala language

License

Notifications You must be signed in to change notification settings

f0rmiga/xtea-scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XTEA for Scala

Implementation in Scala language of XTEA block cipher crypto algorithm and CBC block cipher mode of operation.

Status

The encryptBlock and decryptBlock are ready, but CBC not.

Usage

val someBytes: Array[Byte] = "0123456789abcdef".getBytes // 128-bit long
val xteaKey: Seq[Int] = XTEA.key(someBytes) // Key computed to be used in encryption/decryption
val random = new java.security.SecureRandom
val iv = new Array[Byte](8) // Initialization vector for CBC mode
random.nextBytes(iv)
val message: String = "Something to encrypt" // String to encrypt
val encrypted: Array[Byte] = XTEA.encryptCBC(message.getBytes("UTF-8"), iv, xteaKey) // Perform encryption
val decrypted: Array[Byte] = XTEA.decryptCBC(encrypted, iv, xteaKey) // Perform decryption
assert(message == XTEA.toString(decrypted)) // Compare not encrypted string to decrypted string

Documentation

Look at the source code, it is well documented.

Dependencies

No dependencies.

License

MIT License.

About

XTEA algorithm and CBC mode of operation implementations in Scala language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages