Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
Import 2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiebremer committed Jul 7, 2022
1 parent 8f174bd commit 2eca048
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion builder/builder.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$copyrightInfo = '/*
* Crypto-JS v2.5.0
* Crypto-JS v2.5.1
* http://code.google.com/p/crypto-js/
* (c) 2009-2011 by Jeff Mott. All rights reserved.
* http://code.google.com/p/crypto-js/wiki/License
Expand Down
8 changes: 4 additions & 4 deletions src/DES.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@
/**
* DES cipher
*/
C.DES = {
var DES = C.DES = {
_blockSize : 2,

_keyschedule : null,
Expand All @@ -910,7 +910,7 @@
options = options || {};

// Determine mode
var mode = options.mode || C.mode.OFB;
var mode = options.mode || new C.mode.OFB;

// Allow mode to override options
if (mode.fixOptions)
Expand Down Expand Up @@ -952,11 +952,11 @@
this._state.finalPerm(message, offset);
},

decrypt : function(message, password, options) {
decrypt : function(ciphertext, password, options) {
options = options || {};

// Determine mode
var mode = options.mode || C.mode.OFB;
var mode = options.mode || new C.mode.OFB;

// Allow mode to override options
if (mode.fixOptions)
Expand Down
2 changes: 2 additions & 0 deletions test/DES-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ TestSuite.add(new YAHOO.tool.TestCase({
Assert.areEqual(inp.toString(), out.toString(),
"DES E(D(x) failed: " + inp.toString() + " became "
+ out.toString());

Assert.areEqual(inp.toString(), Crypto.DES.decrypt(Crypto.DES.encrypt(inp.slice(0), key), key, { asBytes: true }).toString());
}
}

Expand Down

0 comments on commit 2eca048

Please sign in to comment.