Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 4.0 #15

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Version 4.0 #15

wants to merge 20 commits into from

Conversation

azjezz
Copy link

@azjezz azjezz commented Nov 16, 2018

NOTE THIS PR CONTAINS HUGE BC BREAKS

  • Add PasswordHasherInterface and default PasswordHasher implementation

    • Add ability to modify the hashing algorithm
    • Add ability to change hashing options
    • Add ability to use different hashing methods ( not recommended )
  • More Test

    • Test PasswordHasher implementation
    • Test Null-Byte Truncation
    • Test Key rotation
  • Set minimum PHP version to 7.1

  • Remove legacy support

  • fixes No opportunity given to change cost of password_hash function #10

  • refactor methods name for cleaner interface lock/check is cleaner and easier to type than hashAndEncrypt/decryptAndVerify

  • pass the key as a constructor argument ( you don't have to keep moving the key around the application )

example :

<?php

use Defuse\Crypto\Key;
use ParagonIE\PasswordLock\{
    PasswordLock,
    Hasher\PasswordHasher
};

// use Argon2I algorithm instead of Bcrypt
$hasher = new PasswordHasher(PASSWORD_ARGON2I, [
    'memory_cost' => 2048
]);

$key = Key::createNewRandomKey();

$password = new PasswordLock($key, $hasher);

$storeMe = $password->lock('password');

assert( $password->check('password', $storeMe) );

@azjezz
Copy link
Author

azjezz commented Nov 16, 2018

cc @paragonie-scott

@paragonie-scott
Copy link
Member

Wow, awesome. I'll check this out over the weekend. At a glance, it looks like a heck of an improvement though. 👍

@azjezz
Copy link
Author

azjezz commented Nov 16, 2018

@paragonie-scott great!

@azjezz azjezz changed the title Version 4.0 [WIP] Version 4.0 Nov 16, 2018
@azjezz azjezz changed the title [WIP] Version 4.0 Version 4.0 Nov 17, 2018
@azjezz azjezz closed this Nov 17, 2018
@azjezz azjezz reopened this Nov 17, 2018
@azjezz
Copy link
Author

azjezz commented Nov 17, 2018

@paragonie-scott if this is too much of a BC break; i suggest deprecating this library for a new paragonie/locker library and :

  • refactor namespace from ParagonIE\PasswordLock to ParagonIE\Locker
  • refactor class name from PasswordLock to PasswordLocker

i have made a ParagonIE\Locker branch, you can take a look at it here.

@rjindael
Copy link

Hi, it's been 2 years (almost 3.) Will this PR ever be merged, or will there be a new library due to backward incompatibility?

@paragonie-scott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No opportunity given to change cost of password_hash function
3 participants