PHP Classes

Kravatte PHP Keccak Farfalle: Encrypt and decrypt data based on Farfalle

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 46 All time: 10,596 This week: 200Up
Version License PHP version Categories
kravatte 1.0The PHP License5PHP 5, Cryptography


This class can encrypt, decrypt and authenticate data based on Keccak Farfalle modes.

It can take data and computes a hash using a given secret key using Farfalle.

The class can also encrypt and decrypt data with a given key also using Farfalle modes.

Innovation Award
PHP Programming Innovation award nominee
January 2021
Number 12
Kravatte is a function that implements a cryptography approach that can be used to encrypt data incrementally as a sequence of blocks of data that can be appended to the encryption output.

This approach is useful when you need to encrypt a stream of data with a length that is unknown initially.

This class implements a pure PHP based solution to encrypt and decrypt data using the Kravatte Farfalle construction.

Manuel Lemos
Picture of Jose Luis Lucas
Name: Jose Luis Lucas <contact>
Classes: 10 packages by
Country: Spain Spain
Age: ???
All time rank: 252366 in Spain Spain
Week rank: 568 Up20 in Spain Spain Up
Innovation award
Innovation award
Nominee: 7x



PHP-Kravatte Achouffe Cipher Suite: Encryption, Decryption, and Authentication Tools based on the Farfalle modes

Based on this Python implementation with minor changes

Kravatte is a high-speed instance of Farfalle based on Keccak-p[1600] permutations, claimed to resist against classical and quantum adversaries. Modes for authentication, encryption and authenticated encryption are defined accordingly.

It pass all tests from

2021 @denobispsis

$x=new Kravatte;


$x->mac('Supersecreto', 'Et in Arcadia ego', 64)



$cipher = $x->Kravatte_SANE_enc($message, $metadata);

[$cipher, $val]


$plain = $x->Kravatte_SANE_dec(pack("H",$cipher[0]), $meta, pack("H",$cipher[1]));

[$message, $val]



$cipher = $x->Kravatte_SANSE_enc($message, $metadata);

[$cipher, $val]


$plain = $x->Kravatte_SANSE_dec(pack("H",$cipher[0]), $meta, pack("H",$cipher[1]));

[$message, $val]


$x->Kravatte_WBC(strlen($message), $tweak,$key);

$cipher = $x->Kravatte_WBC_enc($message);
$x->Kravatte_WBC(strlen($message), $tweak,$key);

$message = $x->Kravatte_WBC_dec(pack("H*",$cipher));


$x->Kravatte_WBC_AE(strlen($message), $key);

$cipher = $x->Kravatte_WBC_AE_enc($message,$metadata);


$plain = $x->Kravatte_WBC_AE_dec(pack("H*",$cipher),$metadata);


$x->KravatteOracle($message, $key);


  Files folder image Files  
File Role Description
Plain text file kravatte_final.php Class Class source
Accessible without login Plain text file Doc. Documentation
Accessible without login Plain text file test_kravatte.php Example Example script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,596
This week:200Up