Merge pull request #11 from kikito/pgimeno-fix-large-strings

Pgimeno fix large strings
This commit is contained in:
Enrique García 2016-07-02 20:38:20 +02:00 committed by GitHub
commit 21d22c1868
3 changed files with 8 additions and 7 deletions

View File

@ -14,13 +14,11 @@ before_install:
- export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH - export PATH=$PATH:$PWD/lua_install/bin # Add directory with all installed binaries to PATH
install: install:
- luarocks install luacheck
- luarocks install busted - luarocks install busted
- luarocks install luacov - luarocks install luacov
- luarocks install luacov-coveralls - luarocks install luacov-coveralls
script: script:
- luacheck --no-unused-args --std max+busted *.lua spec
- busted --verbose --coverage - busted --verbose --coverage
after_success: after_success:

View File

@ -346,7 +346,8 @@ local function transform(A,B,C,D,X)
c=z(i,c,d,a,b,X[ 2],15,t[63]) c=z(i,c,d,a,b,X[ 2],15,t[63])
b=z(i,b,c,d,a,X[ 9],21,t[64]) b=z(i,b,c,d,a,X[ 9],21,t[64])
return A+a,B+b,C+c,D+d return bit_and(A+a,0xFFFFFFFF),bit_and(B+b,0xFFFFFFFF),
bit_and(C+c,0xFFFFFFFF),bit_and(D+d,0xFFFFFFFF)
end end
---------------------------------------------------------------- ----------------------------------------------------------------

View File

@ -15,16 +15,18 @@ describe('md5', function()
assert.equal(md5.sumhexa('The quick brown fox jumps over the lazy dog.'), 'e4d909c290d0fb1ca068ffaddf22cbd0') assert.equal(md5.sumhexa('The quick brown fox jumps over the lazy dog.'), 'e4d909c290d0fb1ca068ffaddf22cbd0')
assert.equal(md5.sumhexa(''), 'd41d8cd98f00b204e9800998ecf8427e') assert.equal(md5.sumhexa(''), 'd41d8cd98f00b204e9800998ecf8427e')
assert.equal(md5.sumhexa(('1'):rep(824)), 'a126fd3611ab8d9b7e8a3384e2fa78a0') assert.equal(md5.sumhexa(('1'):rep(824)), 'a126fd3611ab8d9b7e8a3384e2fa78a0')
assert.equal(md5.sumhexa(('1'):rep(1528)), '3750b6a29d923b633e05d6ae76895664')
end) end)
end) end)
describe('md5.sum', function() describe('md5.sum', function()
it('works', function() it('works', function()
assert.equal(md5.sum("asdf"), hex2bin '912ec803b2ce49e4a541068d495ab570') assert.equal(md5.sum("asdf"), hex2bin '912ec803b2ce49e4a541068d495ab570')
assert.equal(md5.sum('The quick brown fox jumps over the lazy dog'), hex2bin'9e107d9d372bb6826bd81d3542a419d6') assert.equal(md5.sum('The quick brown fox jumps over the lazy dog'), hex2bin '9e107d9d372bb6826bd81d3542a419d6')
assert.equal(md5.sum('The quick brown fox jumps over the lazy dog.'), hex2bin'e4d909c290d0fb1ca068ffaddf22cbd0') assert.equal(md5.sum('The quick brown fox jumps over the lazy dog.'), hex2bin 'e4d909c290d0fb1ca068ffaddf22cbd0')
assert.equal(md5.sum(''), hex2bin'd41d8cd98f00b204e9800998ecf8427e') assert.equal(md5.sum(''), hex2bin 'd41d8cd98f00b204e9800998ecf8427e')
assert.equal(md5.sum(('1'):rep(824)), hex2bin'a126fd3611ab8d9b7e8a3384e2fa78a0') assert.equal(md5.sum(('1'):rep(824)), hex2bin 'a126fd3611ab8d9b7e8a3384e2fa78a0')
assert.equal(md5.sum(('1'):rep(1528)), hex2bin '3750b6a29d923b633e05d6ae76895664')
end) end)
end) end)
end) end)