Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SodiumFreePasswordEncryptor ( Salt-less MD5, SHA, &c ) - The necessary evil for seamlessly migrating accounts/passwords into SilverStripe 3.1 + projects
<?php
/**
* Sodium Free Password Encryptor -- for importing legacy passwords
* into SilverSripe 3.1+ projects
*
* 1. Register via mysite/_config/encryptors.yml, e.g.
**
---
PasswordEncryptor:
encryptors:
sf_md5:
SodiumFreePasswordEncryptor: md5
sf_sha1:
SodiumFreePasswordEncryptor: sha1
* example usage
**
$member = new Member();
$member->Email = 'brice@brice.com';
$member->Password = 'brice';
$member->PasswordEncryption = 'sf_md5';
$member->write();
**
*/
class SodiumFreePasswordEncryptor extends PasswordEncryptor_PHPHash {
public function salt($password, $member = null){
return '';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.