Skip to content

Commit

Permalink
Bugfix: PwdHash ignored variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sr-verde committed Feb 28, 2017
1 parent a9ff6e2 commit f49306d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ <h1>Mobiler Hash-Passwort-Generator</h1>
<script>
function hash(master, domain) {
passwordLength = parseInt(document.getElementById('passwordLength').value);
var MD5 = new Hashes.MD5
var SHA1 = new Hashes.SHA1
var SHA256 = new Hashes.SHA256
var SHA512 = new Hashes.SHA512
var RMD160 = new Hashes.RMD160
switch (document.getElementById('algorithm').selectedIndex){
case 0: return pwdHash.getHashedPassword(master, domain);
var MD5 = new Hashes.MD5;
var SHA1 = new Hashes.SHA1;
var SHA256 = new Hashes.SHA256;
var SHA512 = new Hashes.SHA512;
var RMD160 = new Hashes.RMD160;
switch (document.getElementById('algorithm').selectedIndex){
case 0: return pwdHash.getHashedPassword(master, domain).substring(0,passwordLength);
case 1: return MD5.hex(master+":"+domain).substring(0,passwordLength);
case 2: return MD5.b64(master+":"+domain).substring(0,passwordLength);
case 3: return SHA1.hex(master+":"+domain).substring(0,passwordLength);
Expand Down
2 changes: 1 addition & 1 deletion src/js/password-hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var pwdHash={
getHashedPassword:function(password, realm) {
password.substring(0,this.len) == this.PasswordPrefix ? password = password.substring(this.len) : false
var SHA512 = new Hashes.SHA512
var hash = SHA512.b64(password, realm);
var hash = SHA512.b64(password + ':' + realm);
var size = password.length + this.len;
var nonalphanumeric = password.match(/\W/) != null;
var result = this.applyConstraints(hash, size, nonalphanumeric);
Expand Down

0 comments on commit f49306d

Please sign in to comment.