Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

A Swift implementation of the Extended Tiny Encryption Algorithm (XTEA)

License

Notifications You must be signed in to change notification settings

Quartettmobile/xtea-swift

Repository files navigation

XTEA Swift implementation

Summary

This is a Swift implementation of the Extended Tiny Encryption Algorithm (XTEA).

Usage

import XTEA

Use the XTEA functions to encipher/decipher data.

    let key = XTEA.Key(k0: 0xf5ff9b28, k1: 0xdc32c866, k2: 0xe65d0706, k3: 0xf6a2189c)
    let plainText = XTEA.Data(v0: 0x646d1ff0, v1: 0x4ff2dd13)
    
    let encrypted = XTEA.encipher(data: plainText, key: key)
    
    ...
    
    val decrypted = XTEA.decipher(data: cipherText, key: key)

Optionally, you can specify the number of XTEA rounds to perform (default: 32, the recommended number) using the rounds parameter:

    let encrypted = XTEA.encipher(data: plainText, key: key, rounds: 36)
  
    val decrypted = XTEA.decipher(data: cipherText, key: key, rounds: 36)

About

A Swift implementation of the Extended Tiny Encryption Algorithm (XTEA)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages