Merge branch 'develop' into icap
Conflicts: dist/web3-light.js dist/web3-light.js.map dist/web3-light.min.js dist/web3.js dist/web3.js.map dist/web3.min.js
This commit is contained in:
commit
fbb9a41bec
|
@ -820,16 +820,25 @@ module.exports = {
|
||||||
* @date 2015
|
* @date 2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
var sha3 = require('crypto-js/sha3');
|
var sha3 = require('crypto-js/sha3');
|
||||||
|
|
||||||
module.exports = function (str) {
|
module.exports = function (str, isNew) {
|
||||||
|
if (str.substr(0, 2) === '0x' && !isNew) {
|
||||||
|
console.warn('requirement of using web3.fromAscii before sha3 is deprecated');
|
||||||
|
console.warn('new usage: \'web3.sha3("hello")\'');
|
||||||
|
console.warn('see https://github.com/ethereum/web3.js/pull/205');
|
||||||
|
console.warn('if you need to hash hex value, you can do \'sha3("0xfff", true)\'');
|
||||||
|
str = utils.toAscii(str);
|
||||||
|
}
|
||||||
|
|
||||||
return sha3(str, {
|
return sha3(str, {
|
||||||
outputLength: 256
|
outputLength: 256
|
||||||
}).toString();
|
}).toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"crypto-js/sha3":33}],7:[function(require,module,exports){
|
},{"./utils":7,"crypto-js/sha3":33}],7:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -820,16 +820,25 @@ module.exports = {
|
||||||
* @date 2015
|
* @date 2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
var sha3 = require('crypto-js/sha3');
|
var sha3 = require('crypto-js/sha3');
|
||||||
|
|
||||||
module.exports = function (str) {
|
module.exports = function (str, isNew) {
|
||||||
|
if (str.substr(0, 2) === '0x' && !isNew) {
|
||||||
|
console.warn('requirement of using web3.fromAscii before sha3 is deprecated');
|
||||||
|
console.warn('new usage: \'web3.sha3("hello")\'');
|
||||||
|
console.warn('see https://github.com/ethereum/web3.js/pull/205');
|
||||||
|
console.warn('if you need to hash hex value, you can do \'sha3("0xfff", true)\'');
|
||||||
|
str = utils.toAscii(str);
|
||||||
|
}
|
||||||
|
|
||||||
return sha3(str, {
|
return sha3(str, {
|
||||||
outputLength: 256
|
outputLength: 256
|
||||||
}).toString();
|
}).toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"crypto-js/sha3":33}],7:[function(require,module,exports){
|
},{"./utils":7,"crypto-js/sha3":33}],7:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -20,9 +20,18 @@
|
||||||
* @date 2015
|
* @date 2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
var sha3 = require('crypto-js/sha3');
|
var sha3 = require('crypto-js/sha3');
|
||||||
|
|
||||||
module.exports = function (str) {
|
module.exports = function (str, isNew) {
|
||||||
|
if (str.substr(0, 2) === '0x' && !isNew) {
|
||||||
|
console.warn('requirement of using web3.fromAscii before sha3 is deprecated');
|
||||||
|
console.warn('new usage: \'web3.sha3("hello")\'');
|
||||||
|
console.warn('see https://github.com/ethereum/web3.js/pull/205');
|
||||||
|
console.warn('if you need to hash hex value, you can do \'sha3("0xfff", true)\'');
|
||||||
|
str = utils.toAscii(str);
|
||||||
|
}
|
||||||
|
|
||||||
return sha3(str, {
|
return sha3(str, {
|
||||||
outputLength: 256
|
outputLength: 256
|
||||||
}).toString();
|
}).toString();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
var chai = require('chai');
|
var chai = require('chai');
|
||||||
var assert = chai.assert;
|
var assert = chai.assert;
|
||||||
var sha3 = require('../lib/utils/sha3');
|
var sha3 = require('../lib/utils/sha3');
|
||||||
|
var web3 = require('../index');
|
||||||
|
|
||||||
describe('lib/utils/sha3', function () {
|
describe('lib/utils/sha3', function () {
|
||||||
var test = function (v, e) {
|
var test = function (v, e) {
|
||||||
|
@ -11,5 +12,6 @@ describe('lib/utils/sha3', function () {
|
||||||
|
|
||||||
test('test123', 'f81b517a242b218999ec8eec0ea6e2ddbef2a367a14e93f4a32a39e260f686ad');
|
test('test123', 'f81b517a242b218999ec8eec0ea6e2ddbef2a367a14e93f4a32a39e260f686ad');
|
||||||
test('test(int)', 'f4d03772bec1e62fbe8c5691e1a9101e520e8f8b5ca612123694632bf3cb51b1');
|
test('test(int)', 'f4d03772bec1e62fbe8c5691e1a9101e520e8f8b5ca612123694632bf3cb51b1');
|
||||||
|
test(web3.fromAscii('test123'), 'f81b517a242b218999ec8eec0ea6e2ddbef2a367a14e93f4a32a39e260f686ad');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue