Skip to content

Commit fa2de1b

Browse files
committed
Merge branch 'dev'
2 parents 0dd90b3 + 5506278 commit fa2de1b

File tree

8 files changed

+115
-16
lines changed

8 files changed

+115
-16
lines changed

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Source files
2+
# ============
3+
*.lua text
4+
5+
# Luadoc output
6+
# =============
7+
*.html text
8+
*.css text

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Compiled Lua sources
2+
luac.out
3+
4+
# luarocks build files
5+
*.src.rock
6+
*.zip
7+
*.tar.gz
8+
9+
# Object files
10+
*.o
11+
*.os
12+
*.ko
13+
*.obj
14+
*.elf
15+
16+
# Precompiled Headers
17+
*.gch
18+
*.pch
19+
20+
# Libraries
21+
*.lib
22+
*.a
23+
*.la
24+
*.lo
25+
*.def
26+
*.exp
27+
28+
# Shared objects (inc. Windows DLLs)
29+
*.dll
30+
*.so
31+
*.so.*
32+
*.dylib
33+
34+
# Executables
35+
*.exe
36+
*.out
37+
*.app
38+
*.i*86
39+
*.x86_64
40+
*.hex
41+
42+
# Eclipse
43+
.buildpath
44+
.project
45+
.settings/

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: lua
2+
3+
cache: apt
4+
5+
before_install:
6+
- sudo apt-get update
7+
8+
install:
9+
- sudo apt-get install --force-yes lua5.2
10+
11+
script:
12+
- cd tests
13+
- lua5.2 test.lua
14+

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Change Log
2+
3+
This project uses [Semantic Versioning](http://semver.org/).
4+
5+
## 1.0.0 -- 2015-12-18
6+
Initial release.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Mark Rogaski
3+
Copyright (c) 2014-2015, Mark Rogaski.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
lua-salsa20
2-
===========
1+
# lua-salsa20
32

43
Salsa20 eStream cipher in Lua.
4+
5+
[![Build Status](https://travis-ci.org/mrogaski/lua-salsa20.png?branch=master)](https://travis-ci.org/mrogaski/lua-salsa20)
6+

salsa20.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
The MIT License (MIT)
44
5-
Copyright (c) 2014 Mark Rogaski
5+
Copyright (c) 2014-2015, Mark Rogaski.
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal

test/test.lua renamed to tests/test.lua

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
The MIT License (MIT)
44
5-
Copyright (c) 2014 Mark Rogaski
5+
Copyright (c) 2014-2015, Mark Rogaski.
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -24,7 +24,11 @@ SOFTWARE.
2424
2525
--]]--------------------------------------------------------------------------
2626

27-
salsa20 = require "salsa20"
27+
package.path = package.path..';../salsa20.lua'
28+
local salsa20 = require "salsa20"
29+
30+
local result
31+
local pass = true
2832

2933
function test_tuple(desc, f, k, n, data)
3034
local c = 0
@@ -52,8 +56,10 @@ function test_tuple(desc, f, k, n, data)
5256
end
5357
if pass == c then
5458
print(string.format("% 32s => PASS: %d/%d", desc, pass, c))
59+
return true
5560
else
5661
print(string.format("% 32s => FAIL: %d/%d", desc, pass, c))
62+
return false
5763
end
5864
end
5965

@@ -71,8 +77,10 @@ function test_map(desc, f, n, data)
7177
end
7278
if pass == c then
7379
print(string.format("% 32s => PASS: %d/%d", desc, pass, c))
80+
return true
7481
else
7582
print(string.format("% 32s => FAIL: %d/%d", desc, pass, c))
83+
return false
7684
end
7785
end
7886

@@ -97,8 +105,10 @@ function test_map_inv(desc, f, n, data)
97105
end
98106
if pass == c then
99107
print(string.format("% 32s => PASS: %d/%d", desc, pass, c))
108+
return true
100109
else
101110
print(string.format("% 32s => FAIL: %d/%d", desc, pass, c))
111+
return false
102112
end
103113
end
104114

@@ -126,8 +136,10 @@ function test_expand(desc, f, data)
126136
end
127137
if pass == c then
128138
print(string.format("% 32s => PASS: %d/%d", desc, pass, c))
139+
return true
129140
else
130141
print(string.format("% 32s => FAIL: %d/%d", desc, pass, c))
142+
return false
131143
end
132144
end
133145

@@ -161,7 +173,9 @@ local data = {
161173
{ 0x3e2f308c, 0xd90a8f36, 0x6ab2a923, 0x2883524c }
162174
},
163175
}
164-
test_tuple("quarterround", salsa20.quarterround, 4, 1, data)
176+
177+
pass = pass and test_tuple("quarterround", salsa20.quarterround, 4, 1, data)
178+
165179

166180
data = {
167181
{
@@ -185,7 +199,8 @@ data = {
185199
0x0040ede5, 0xb545fbce, 0xd257ed4f, 0x1818882d }
186200
},
187201
}
188-
test_tuple("rowround", salsa20.rowround, 16, 1, data)
202+
203+
pass = pass and test_tuple("rowround", salsa20.rowround, 16, 1, data)
189204

190205
data = {
191206
{
@@ -209,7 +224,8 @@ data = {
209224
0x481c2027, 0x53a8e4b5, 0x4c1f89c5, 0x3f78c9c8 }
210225
},
211226
}
212-
test_tuple("columnround", salsa20.columnround, 16, 1, data)
227+
228+
pass = pass and test_tuple("columnround", salsa20.columnround, 16, 1, data)
213229

214230
data = {
215231
{
@@ -233,21 +249,24 @@ data = {
233249
0xa74b2ad6, 0xbc331c5c, 0x1dda24c7, 0xee928277 }
234250
}
235251
}
236-
test_tuple("doubleround", salsa20.doubleround, 16, 1, data)
252+
253+
pass = pass and test_tuple("doubleround", salsa20.doubleround, 16, 1, data)
237254

238255
data = {
239256
{ { 0, 0, 0, 0 }, 0x00000000 },
240257
{ { 86, 75, 30, 9 }, 0x091e4b56 },
241258
{ { 255, 255, 255, 250 }, 0xfaffffff },
242259
}
243-
test_map("littleendian", salsa20.littleendian, 4, data)
260+
261+
pass = pass and test_map("littleendian", salsa20.littleendian, 4, data)
244262

245263
data = {
246264
{ 0x00000000, { 0, 0, 0, 0 } },
247265
{ 0x091e4b56, { 86, 75, 30, 9 } },
248266
{ 0xfaffffff, { 255, 255, 255, 250 } },
249267
}
250-
test_map_inv("littleendian_inv", salsa20.littleendian_inv, 4, data)
268+
269+
pass = pass and test_map_inv("littleendian_inv", salsa20.littleendian_inv, 4, data)
251270

252271
data = {
253272
{
@@ -281,7 +300,8 @@ data = {
281300
27, 111, 114, 114, 118, 40, 152, 157, 180, 57, 27, 94, 107, 42, 236, 35 }
282301
},
283302
}
284-
test_tuple("hash", salsa20.hash, 64, 1, data)
303+
304+
pass = pass and test_tuple("hash", salsa20.hash, 64, 1, data)
285305

286306
data = {
287307
{
@@ -295,7 +315,8 @@ data = {
295315
122, 127, 195, 185, 185, 204, 188, 90, 245, 9, 183, 248, 226, 85, 245, 104 }
296316
},
297317
}
298-
-- test_tuple("hash^1000000", salsa20.hash, 64, 1000000, data)
318+
319+
-- pass = pass and test_tuple("hash^1000000", salsa20.hash, 64, 1000000, data)
299320

300321
data = {
301322
{
@@ -316,7 +337,8 @@ data = {
316337
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 116, 101, 32, 107 }
317338
},
318339
}
319-
test_expand("expand", salsa20.expand, data)
340+
341+
pass = pass and test_expand("expand", salsa20.expand, data)
320342

321343
data = {
322344
{
@@ -340,5 +362,7 @@ data = {
340362
14, 232, 5, 16, 151, 140, 183, 141, 171, 9, 122, 181, 104, 182, 177, 193 }
341363
},
342364
}
343-
test_tuple("expand + hash", salsa20.hash, 64, 1, data)
344365

366+
pass = pass and test_tuple("expand + hash", salsa20.hash, 64, 1, data)
367+
368+
os.exit(pass and 0 or 1)

0 commit comments

Comments
 (0)