Skip to content

ademarre/mcf-hash-encoder-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Binary MCF Encoding in PHP

The McfHash class is a PHP implementation of Binary Modular Crypt Format (BMCF) encoding. Only the Bcrypt BMCF definition is implemented.

You can use McfHash::decode() to convert a Bcrypt hash from the usual 60-character notation to its compact 40-byte binary form.

$hash = '$2y$14$i5btSOiulHhaPHPbgNUGdObga/GC.AVG/y5HHY1ra7L0C9dpCaw8u'; // 60 bytes ACSII
$mcfEncoder = new McfHash();
$binaryHash = $mcfEncoder->decode($hash); // 40 bytes binary

Use McfHash::encode() to reconstruct the hash.

$hash = $mcfEncoder->encode($binaryHash);
// $2y$14$i5btSOiulHhaPHPbgNUGdObga/GC.AVG/y5HHY1ra7L0C9dpCaw8u

About

A PHP Implementation of Binary Modular Crypt Format (BMCF)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages