immunio 1.2.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -5
- data/ext/immunio/Rakefile +14 -6
- data/lib/immunio/context.rb +2 -0
- data/lib/immunio/plugins/action_view.rb +7 -668
- data/lib/immunio/plugins/action_view/action_view.rb +22 -0
- data/lib/immunio/plugins/action_view/active_support_hash.rb +29 -0
- data/lib/immunio/plugins/action_view/cache_store.rb +24 -0
- data/lib/immunio/plugins/action_view/erubi.rb +38 -0
- data/lib/immunio/plugins/action_view/erubis.rb +39 -0
- data/lib/immunio/plugins/action_view/fragment_caching.rb +29 -0
- data/lib/immunio/plugins/action_view/haml.rb +46 -0
- data/lib/immunio/plugins/action_view/slim.rb +42 -0
- data/lib/immunio/plugins/action_view/template.rb +431 -0
- data/lib/immunio/plugins/action_view/template_rendering.rb +45 -0
- data/lib/immunio/plugins/http_tracker.rb +2 -0
- data/lib/immunio/plugins/io.rb +34 -0
- data/lib/immunio/version.rb +1 -1
- data/lua-hooks/Makefile +36 -9
- data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
- data/lua-hooks/ext/luajit/Makefile +22 -15
- data/lua-hooks/ext/luajit/README +2 -2
- data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
- data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
- data/lua-hooks/ext/luajit/doc/changes.html +69 -3
- data/lua-hooks/ext/luajit/doc/contact.html +10 -3
- data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +3 -4
- data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_jit.html +3 -3
- data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
- data/lua-hooks/ext/luajit/doc/extensions.html +47 -20
- data/lua-hooks/ext/luajit/doc/faq.html +2 -2
- data/lua-hooks/ext/luajit/doc/install.html +74 -45
- data/lua-hooks/ext/luajit/doc/luajit.html +5 -5
- data/lua-hooks/ext/luajit/doc/running.html +3 -3
- data/lua-hooks/ext/luajit/doc/status.html +13 -8
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +8 -5
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +66 -11
- data/lua-hooks/ext/luajit/dynasm/dasm_mips64.lua +12 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +5 -1
- data/lua-hooks/ext/luajit/dynasm/dynasm.lua +2 -2
- data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
- data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
- data/lua-hooks/ext/luajit/src/Makefile +15 -11
- data/lua-hooks/ext/luajit/src/Makefile.dep +16 -16
- data/lua-hooks/ext/luajit/src/host/buildvm.c +2 -2
- data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +9 -4
- data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +2 -2
- data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +14 -3
- data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +27 -3
- data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
- data/lua-hooks/ext/luajit/src/host/genminilua.lua +6 -5
- data/lua-hooks/ext/luajit/src/host/minilua.c +1 -1
- data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/bcsave.lua +8 -8
- data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_arm64.lua +1216 -0
- data/lua-hooks/ext/luajit/src/jit/dis_arm64be.lua +12 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +35 -20
- data/lua-hooks/ext/luajit/src/jit/dis_mips64.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips64el.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +7 -4
- data/lua-hooks/ext/luajit/src/jit/dump.lua +17 -12
- data/lua-hooks/ext/luajit/src/jit/p.lua +3 -2
- data/lua-hooks/ext/luajit/src/jit/v.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
- data/lua-hooks/ext/luajit/src/lauxlib.h +14 -20
- data/lua-hooks/ext/luajit/src/lib_aux.c +38 -27
- data/lua-hooks/ext/luajit/src/lib_base.c +12 -5
- data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_debug.c +5 -5
- data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -2
- data/lua-hooks/ext/luajit/src/lib_init.c +16 -16
- data/lua-hooks/ext/luajit/src/lib_io.c +6 -7
- data/lua-hooks/ext/luajit/src/lib_jit.c +14 -4
- data/lua-hooks/ext/luajit/src/lib_math.c +1 -5
- data/lua-hooks/ext/luajit/src/lib_os.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_package.c +14 -23
- data/lua-hooks/ext/luajit/src/lib_string.c +1 -5
- data/lua-hooks/ext/luajit/src/lib_table.c +21 -1
- data/lua-hooks/ext/luajit/src/lj.supp +3 -3
- data/lua-hooks/ext/luajit/src/lj_alloc.c +174 -83
- data/lua-hooks/ext/luajit/src/lj_api.c +97 -18
- data/lua-hooks/ext/luajit/src/lj_arch.h +54 -22
- data/lua-hooks/ext/luajit/src/lj_asm.c +172 -53
- data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_asm_arm.h +19 -16
- data/lua-hooks/ext/luajit/src/lj_asm_arm64.h +2022 -0
- data/lua-hooks/ext/luajit/src/lj_asm_mips.h +564 -158
- data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +19 -18
- data/lua-hooks/ext/luajit/src/lj_asm_x86.h +578 -92
- data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ccall.c +172 -7
- data/lua-hooks/ext/luajit/src/lj_ccall.h +21 -5
- data/lua-hooks/ext/luajit/src/lj_ccallback.c +71 -17
- data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cconv.c +4 -2
- data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cdata.c +7 -5
- data/lua-hooks/ext/luajit/src/lj_cdata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_clib.c +5 -5
- data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cparse.c +11 -6
- data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_crecord.c +70 -14
- data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.h +8 -8
- data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_def.h +6 -9
- data/lua-hooks/ext/luajit/src/lj_dispatch.c +3 -3
- data/lua-hooks/ext/luajit/src/lj_dispatch.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_emit_arm.h +5 -4
- data/lua-hooks/ext/luajit/src/lj_emit_arm64.h +419 -0
- data/lua-hooks/ext/luajit/src/lj_emit_mips.h +100 -20
- data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +4 -4
- data/lua-hooks/ext/luajit/src/lj_emit_x86.h +116 -25
- data/lua-hooks/ext/luajit/src/lj_err.c +34 -13
- data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ffrecord.c +58 -49
- data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_frame.h +33 -6
- data/lua-hooks/ext/luajit/src/lj_func.c +4 -2
- data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gc.c +16 -7
- data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.c +31 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ir.c +69 -96
- data/lua-hooks/ext/luajit/src/lj_ir.h +29 -18
- data/lua-hooks/ext/luajit/src/lj_ircall.h +24 -30
- data/lua-hooks/ext/luajit/src/lj_iropt.h +9 -9
- data/lua-hooks/ext/luajit/src/lj_jit.h +67 -9
- data/lua-hooks/ext/luajit/src/lj_lex.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_mcode.c +11 -10
- data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.h +7 -3
- data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_fold.c +84 -17
- data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_mem.c +3 -3
- data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +24 -22
- data/lua-hooks/ext/luajit/src/lj_opt_sink.c +11 -6
- data/lua-hooks/ext/luajit/src/lj_opt_split.c +11 -2
- data/lua-hooks/ext/luajit/src/lj_parse.c +9 -7
- data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_record.c +201 -117
- data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_snap.c +72 -26
- data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_state.c +6 -6
- data/lua-hooks/ext/luajit/src/lj_state.h +2 -2
- data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt.c +7 -3
- data/lua-hooks/ext/luajit/src/lj_strfmt.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +4 -3
- data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_tab.c +1 -2
- data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target.h +3 -3
- data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_arm64.h +239 -7
- data/lua-hooks/ext/luajit/src/lj_target_mips.h +111 -22
- data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_x86.h +21 -4
- data/lua-hooks/ext/luajit/src/lj_trace.c +63 -18
- data/lua-hooks/ext/luajit/src/lj_trace.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vm.h +5 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmmath.c +1 -1
- data/lua-hooks/ext/luajit/src/ljamalg.c +1 -1
- data/lua-hooks/ext/luajit/src/lua.h +9 -1
- data/lua-hooks/ext/luajit/src/luaconf.h +3 -7
- data/lua-hooks/ext/luajit/src/luajit.c +69 -54
- data/lua-hooks/ext/luajit/src/luajit.h +4 -4
- data/lua-hooks/ext/luajit/src/lualib.h +1 -1
- data/lua-hooks/ext/luajit/src/msvcbuild.bat +12 -4
- data/lua-hooks/ext/luajit/src/vm_arm.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_arm64.dasc +255 -32
- data/lua-hooks/ext/luajit/src/vm_mips.dasc +26 -23
- data/lua-hooks/ext/luajit/src/vm_mips64.dasc +5062 -0
- data/lua-hooks/ext/luajit/src/vm_ppc.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_x64.dasc +24 -25
- data/lua-hooks/ext/luajit/src/vm_x86.dasc +77 -4
- data/lua-hooks/libluahooks.darwin.a +0 -0
- data/lua-hooks/libluahooks.linux.a +0 -0
- data/lua-hooks/options.mk +1 -1
- metadata +37 -77
- data/lua-hooks/ext/all.c +0 -69
- data/lua-hooks/ext/libinjection/COPYING +0 -37
- data/lua-hooks/ext/libinjection/libinjection.h +0 -65
- data/lua-hooks/ext/libinjection/libinjection_html5.c +0 -847
- data/lua-hooks/ext/libinjection/libinjection_html5.h +0 -54
- data/lua-hooks/ext/libinjection/libinjection_sqli.c +0 -2301
- data/lua-hooks/ext/libinjection/libinjection_sqli.h +0 -295
- data/lua-hooks/ext/libinjection/libinjection_sqli_data.h +0 -9349
- data/lua-hooks/ext/libinjection/libinjection_xss.c +0 -531
- data/lua-hooks/ext/libinjection/libinjection_xss.h +0 -21
- data/lua-hooks/ext/libinjection/lualib.c +0 -145
- data/lua-hooks/ext/libinjection/module.mk +0 -5
- data/lua-hooks/ext/lpeg/HISTORY +0 -96
- data/lua-hooks/ext/lpeg/lpcap.c +0 -537
- data/lua-hooks/ext/lpeg/lpcap.h +0 -56
- data/lua-hooks/ext/lpeg/lpcode.c +0 -1014
- data/lua-hooks/ext/lpeg/lpcode.h +0 -40
- data/lua-hooks/ext/lpeg/lpeg-128.gif +0 -0
- data/lua-hooks/ext/lpeg/lpeg.html +0 -1445
- data/lua-hooks/ext/lpeg/lpprint.c +0 -244
- data/lua-hooks/ext/lpeg/lpprint.h +0 -36
- data/lua-hooks/ext/lpeg/lptree.c +0 -1303
- data/lua-hooks/ext/lpeg/lptree.h +0 -82
- data/lua-hooks/ext/lpeg/lptypes.h +0 -149
- data/lua-hooks/ext/lpeg/lpvm.c +0 -364
- data/lua-hooks/ext/lpeg/lpvm.h +0 -58
- data/lua-hooks/ext/lpeg/makefile +0 -55
- data/lua-hooks/ext/lpeg/module.mk +0 -6
- data/lua-hooks/ext/lpeg/re.html +0 -498
- data/lua-hooks/ext/lua-cmsgpack/.gitignore +0 -13
- data/lua-hooks/ext/lua-cmsgpack/CMakeLists.txt +0 -45
- data/lua-hooks/ext/lua-cmsgpack/README.md +0 -115
- data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +0 -970
- data/lua-hooks/ext/lua-cmsgpack/module.mk +0 -2
- data/lua-hooks/ext/lua-cmsgpack/test.lua +0 -570
- data/lua-hooks/ext/lua-snapshot/LICENSE +0 -7
- data/lua-hooks/ext/lua-snapshot/Makefile +0 -12
- data/lua-hooks/ext/lua-snapshot/README.md +0 -18
- data/lua-hooks/ext/lua-snapshot/dump.lua +0 -15
- data/lua-hooks/ext/lua-snapshot/module.mk +0 -2
- data/lua-hooks/ext/lua-snapshot/snapshot.c +0 -462
- data/lua-hooks/ext/luautf8/README.md +0 -152
- data/lua-hooks/ext/luautf8/lutf8lib.c +0 -1274
- data/lua-hooks/ext/luautf8/module.mk +0 -2
- data/lua-hooks/ext/luautf8/unidata.h +0 -3064
- data/lua-hooks/ext/module.mk +0 -15
- data/lua-hooks/ext/modules.h +0 -17
- data/lua-hooks/ext/perf/luacpu.c +0 -114
- data/lua-hooks/ext/perf/lualoadavg.c +0 -40
- data/lua-hooks/ext/perf/luameminfo.c +0 -38
- data/lua-hooks/ext/perf/luaoslib.c +0 -203
- data/lua-hooks/ext/perf/module.mk +0 -5
- data/lua-hooks/ext/sha1/luasha1.c +0 -74
- data/lua-hooks/ext/sha1/module.mk +0 -5
- data/lua-hooks/ext/sha1/sha1.c +0 -145
- data/lua-hooks/ext/sha2/luasha256.c +0 -77
- data/lua-hooks/ext/sha2/module.mk +0 -5
- data/lua-hooks/ext/sha2/sha256.c +0 -196
- data/lua-hooks/ext/sysutils/lua_utils.c +0 -56
- data/lua-hooks/ext/sysutils/module.mk +0 -2
data/lua-hooks/ext/sha1/sha1.c
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* SHA-1 hash in C
|
3
|
-
*
|
4
|
-
* Copyright (c) 2014 Project Nayuki
|
5
|
-
* http://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly
|
6
|
-
*
|
7
|
-
* (MIT License)
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
-
* this software and associated documentation files (the "Software"), to deal in
|
10
|
-
* the Software without restriction, including without limitation the rights to
|
11
|
-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
12
|
-
* the Software, and to permit persons to whom the Software is furnished to do so,
|
13
|
-
* subject to the following conditions:
|
14
|
-
* - The above copyright notice and this permission notice shall be included in
|
15
|
-
* all copies or substantial portions of the Software.
|
16
|
-
* - The Software is provided "as is", without warranty of any kind, express or
|
17
|
-
* implied, including but not limited to the warranties of merchantability,
|
18
|
-
* fitness for a particular purpose and noninfringement. In no event shall the
|
19
|
-
* authors or copyright holders be liable for any claim, damages or other
|
20
|
-
* liability, whether in an action of contract, tort or otherwise, arising from,
|
21
|
-
* out of or in connection with the Software or the use or other dealings in the
|
22
|
-
* Software.
|
23
|
-
*/
|
24
|
-
|
25
|
-
#include <stdint.h>
|
26
|
-
|
27
|
-
|
28
|
-
void sha1_compress(uint32_t state[5], const uint8_t block[64]) {
|
29
|
-
#define SCHEDULE(i) \
|
30
|
-
temp = schedule[(i - 3) & 0xF] ^ schedule[(i - 8) & 0xF] ^ schedule[(i - 14) & 0xF] ^ schedule[(i - 16) & 0xF]; \
|
31
|
-
schedule[i & 0xF] = temp << 1 | temp >> 31;
|
32
|
-
|
33
|
-
#define LOADSCHEDULE(i) \
|
34
|
-
schedule[i] = \
|
35
|
-
(uint32_t)block[i * 4 + 0] << 24 \
|
36
|
-
| (uint32_t)block[i * 4 + 1] << 16 \
|
37
|
-
| (uint32_t)block[i * 4 + 2] << 8 \
|
38
|
-
| (uint32_t)block[i * 4 + 3];
|
39
|
-
|
40
|
-
#define ROUND0a(a, b, c, d, e, i) LOADSCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) | (~b & d)) , i, 0x5A827999)
|
41
|
-
#define ROUND0b(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) | (~b & d)) , i, 0x5A827999)
|
42
|
-
#define ROUND1(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, (b ^ c ^ d) , i, 0x6ED9EBA1)
|
43
|
-
#define ROUND2(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) ^ (b & d) ^ (c & d)), i, 0x8F1BBCDC)
|
44
|
-
#define ROUND3(a, b, c, d, e, i) SCHEDULE(i) ROUNDTAIL(a, b, e, (b ^ c ^ d) , i, 0xCA62C1D6)
|
45
|
-
|
46
|
-
#define ROUNDTAIL(a, b, e, f, i, k) \
|
47
|
-
e += (a << 5 | a >> 27) + f + UINT32_C(k) + schedule[i & 0xF]; \
|
48
|
-
b = b << 30 | b >> 2;
|
49
|
-
|
50
|
-
uint32_t a = state[0];
|
51
|
-
uint32_t b = state[1];
|
52
|
-
uint32_t c = state[2];
|
53
|
-
uint32_t d = state[3];
|
54
|
-
uint32_t e = state[4];
|
55
|
-
|
56
|
-
uint32_t schedule[16];
|
57
|
-
uint32_t temp;
|
58
|
-
ROUND0a(a, b, c, d, e, 0)
|
59
|
-
ROUND0a(e, a, b, c, d, 1)
|
60
|
-
ROUND0a(d, e, a, b, c, 2)
|
61
|
-
ROUND0a(c, d, e, a, b, 3)
|
62
|
-
ROUND0a(b, c, d, e, a, 4)
|
63
|
-
ROUND0a(a, b, c, d, e, 5)
|
64
|
-
ROUND0a(e, a, b, c, d, 6)
|
65
|
-
ROUND0a(d, e, a, b, c, 7)
|
66
|
-
ROUND0a(c, d, e, a, b, 8)
|
67
|
-
ROUND0a(b, c, d, e, a, 9)
|
68
|
-
ROUND0a(a, b, c, d, e, 10)
|
69
|
-
ROUND0a(e, a, b, c, d, 11)
|
70
|
-
ROUND0a(d, e, a, b, c, 12)
|
71
|
-
ROUND0a(c, d, e, a, b, 13)
|
72
|
-
ROUND0a(b, c, d, e, a, 14)
|
73
|
-
ROUND0a(a, b, c, d, e, 15)
|
74
|
-
ROUND0b(e, a, b, c, d, 16)
|
75
|
-
ROUND0b(d, e, a, b, c, 17)
|
76
|
-
ROUND0b(c, d, e, a, b, 18)
|
77
|
-
ROUND0b(b, c, d, e, a, 19)
|
78
|
-
ROUND1(a, b, c, d, e, 20)
|
79
|
-
ROUND1(e, a, b, c, d, 21)
|
80
|
-
ROUND1(d, e, a, b, c, 22)
|
81
|
-
ROUND1(c, d, e, a, b, 23)
|
82
|
-
ROUND1(b, c, d, e, a, 24)
|
83
|
-
ROUND1(a, b, c, d, e, 25)
|
84
|
-
ROUND1(e, a, b, c, d, 26)
|
85
|
-
ROUND1(d, e, a, b, c, 27)
|
86
|
-
ROUND1(c, d, e, a, b, 28)
|
87
|
-
ROUND1(b, c, d, e, a, 29)
|
88
|
-
ROUND1(a, b, c, d, e, 30)
|
89
|
-
ROUND1(e, a, b, c, d, 31)
|
90
|
-
ROUND1(d, e, a, b, c, 32)
|
91
|
-
ROUND1(c, d, e, a, b, 33)
|
92
|
-
ROUND1(b, c, d, e, a, 34)
|
93
|
-
ROUND1(a, b, c, d, e, 35)
|
94
|
-
ROUND1(e, a, b, c, d, 36)
|
95
|
-
ROUND1(d, e, a, b, c, 37)
|
96
|
-
ROUND1(c, d, e, a, b, 38)
|
97
|
-
ROUND1(b, c, d, e, a, 39)
|
98
|
-
ROUND2(a, b, c, d, e, 40)
|
99
|
-
ROUND2(e, a, b, c, d, 41)
|
100
|
-
ROUND2(d, e, a, b, c, 42)
|
101
|
-
ROUND2(c, d, e, a, b, 43)
|
102
|
-
ROUND2(b, c, d, e, a, 44)
|
103
|
-
ROUND2(a, b, c, d, e, 45)
|
104
|
-
ROUND2(e, a, b, c, d, 46)
|
105
|
-
ROUND2(d, e, a, b, c, 47)
|
106
|
-
ROUND2(c, d, e, a, b, 48)
|
107
|
-
ROUND2(b, c, d, e, a, 49)
|
108
|
-
ROUND2(a, b, c, d, e, 50)
|
109
|
-
ROUND2(e, a, b, c, d, 51)
|
110
|
-
ROUND2(d, e, a, b, c, 52)
|
111
|
-
ROUND2(c, d, e, a, b, 53)
|
112
|
-
ROUND2(b, c, d, e, a, 54)
|
113
|
-
ROUND2(a, b, c, d, e, 55)
|
114
|
-
ROUND2(e, a, b, c, d, 56)
|
115
|
-
ROUND2(d, e, a, b, c, 57)
|
116
|
-
ROUND2(c, d, e, a, b, 58)
|
117
|
-
ROUND2(b, c, d, e, a, 59)
|
118
|
-
ROUND3(a, b, c, d, e, 60)
|
119
|
-
ROUND3(e, a, b, c, d, 61)
|
120
|
-
ROUND3(d, e, a, b, c, 62)
|
121
|
-
ROUND3(c, d, e, a, b, 63)
|
122
|
-
ROUND3(b, c, d, e, a, 64)
|
123
|
-
ROUND3(a, b, c, d, e, 65)
|
124
|
-
ROUND3(e, a, b, c, d, 66)
|
125
|
-
ROUND3(d, e, a, b, c, 67)
|
126
|
-
ROUND3(c, d, e, a, b, 68)
|
127
|
-
ROUND3(b, c, d, e, a, 69)
|
128
|
-
ROUND3(a, b, c, d, e, 70)
|
129
|
-
ROUND3(e, a, b, c, d, 71)
|
130
|
-
ROUND3(d, e, a, b, c, 72)
|
131
|
-
ROUND3(c, d, e, a, b, 73)
|
132
|
-
ROUND3(b, c, d, e, a, 74)
|
133
|
-
ROUND3(a, b, c, d, e, 75)
|
134
|
-
ROUND3(e, a, b, c, d, 76)
|
135
|
-
ROUND3(d, e, a, b, c, 77)
|
136
|
-
ROUND3(c, d, e, a, b, 78)
|
137
|
-
ROUND3(b, c, d, e, a, 79)
|
138
|
-
|
139
|
-
state[0] += a;
|
140
|
-
state[1] += b;
|
141
|
-
state[2] += c;
|
142
|
-
state[3] += d;
|
143
|
-
state[4] += e;
|
144
|
-
}
|
145
|
-
|
@@ -1,77 +0,0 @@
|
|
1
|
-
#include <stdint.h>
|
2
|
-
#include <stdio.h>
|
3
|
-
#include <string.h>
|
4
|
-
|
5
|
-
#define LUA_LIB
|
6
|
-
#include "lua.h"
|
7
|
-
#include "lauxlib.h"
|
8
|
-
|
9
|
-
// Link this program with an external C or x86 compression function
|
10
|
-
extern void sha256_compress(uint32_t state[8], const uint8_t block[64]);
|
11
|
-
|
12
|
-
/* This function is implements the padding and blocking around the SHA2 compression function
|
13
|
-
*
|
14
|
-
* Copyright (c) 2014 Project Nayuki
|
15
|
-
* http://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly
|
16
|
-
*/
|
17
|
-
static void
|
18
|
-
sha256_hash(const uint8_t *message, uint32_t len, uint32_t hash[8]) {
|
19
|
-
hash[0] = UINT32_C(0x6A09E667);
|
20
|
-
hash[1] = UINT32_C(0xBB67AE85);
|
21
|
-
hash[2] = UINT32_C(0x3C6EF372);
|
22
|
-
hash[3] = UINT32_C(0xA54FF53A);
|
23
|
-
hash[4] = UINT32_C(0x510E527F);
|
24
|
-
hash[5] = UINT32_C(0x9B05688C);
|
25
|
-
hash[6] = UINT32_C(0x1F83D9AB);
|
26
|
-
hash[7] = UINT32_C(0x5BE0CD19);
|
27
|
-
|
28
|
-
uint32_t i;
|
29
|
-
for (i = 0; len - i >= 64; i += 64)
|
30
|
-
sha256_compress(hash, message + i);
|
31
|
-
|
32
|
-
uint8_t block[64];
|
33
|
-
uint32_t rem = len - i;
|
34
|
-
memcpy(block, message + i, rem);
|
35
|
-
|
36
|
-
block[rem] = 0x80;
|
37
|
-
rem++;
|
38
|
-
if (64 - rem >= 8)
|
39
|
-
memset(block + rem, 0, 56 - rem);
|
40
|
-
else {
|
41
|
-
memset(block + rem, 0, 64 - rem);
|
42
|
-
sha256_compress(hash, block);
|
43
|
-
memset(block, 0, 56);
|
44
|
-
}
|
45
|
-
|
46
|
-
uint64_t longLen = ((uint64_t)len) << 3;
|
47
|
-
for (i = 0; i < 8; i++)
|
48
|
-
block[64 - 1 - i] = (uint8_t)(longLen >> (i * 8));
|
49
|
-
sha256_compress(hash, block);
|
50
|
-
}
|
51
|
-
|
52
|
-
/* Immunio Lua bindings */
|
53
|
-
|
54
|
-
static int
|
55
|
-
lua_sha256(lua_State *L) {
|
56
|
-
uint32_t hash[8] = {};
|
57
|
-
char buf[65];
|
58
|
-
size_t slen = 0;
|
59
|
-
|
60
|
-
const char *input = luaL_checklstring(L, 1, &slen);
|
61
|
-
sha256_hash(input, slen, hash);
|
62
|
-
sprintf(buf, "%08x%08x%08x%08x%08x%08x%08x%08x", hash[0], hash[1], hash[2], hash[3], hash[4], hash[5], hash[6], hash[7]);
|
63
|
-
lua_pushlstring(L, buf, 64);
|
64
|
-
return 1;
|
65
|
-
}
|
66
|
-
|
67
|
-
static const luaL_Reg libsha256[] = {
|
68
|
-
{"sha256", lua_sha256},
|
69
|
-
{NULL, NULL}
|
70
|
-
};
|
71
|
-
|
72
|
-
int
|
73
|
-
luaopen_sha256(lua_State *L) {
|
74
|
-
// luaL_checkversion(L);
|
75
|
-
luaL_register(L, "sha2", libsha256);
|
76
|
-
return 1;
|
77
|
-
}
|
data/lua-hooks/ext/sha2/sha256.c
DELETED
@@ -1,196 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* SHA-256 hash in C
|
3
|
-
*
|
4
|
-
* Copyright (c) 2014 Project Nayuki
|
5
|
-
* http://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly
|
6
|
-
*
|
7
|
-
* (MIT License)
|
8
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
9
|
-
* this software and associated documentation files (the "Software"), to deal in
|
10
|
-
* the Software without restriction, including without limitation the rights to
|
11
|
-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
12
|
-
* the Software, and to permit persons to whom the Software is furnished to do so,
|
13
|
-
* subject to the following conditions:
|
14
|
-
* - The above copyright notice and this permission notice shall be included in
|
15
|
-
* all copies or substantial portions of the Software.
|
16
|
-
* - The Software is provided "as is", without warranty of any kind, express or
|
17
|
-
* implied, including but not limited to the warranties of merchantability,
|
18
|
-
* fitness for a particular purpose and noninfringement. In no event shall the
|
19
|
-
* authors or copyright holders be liable for any claim, damages or other
|
20
|
-
* liability, whether in an action of contract, tort or otherwise, arising from,
|
21
|
-
* out of or in connection with the Software or the use or other dealings in the
|
22
|
-
* Software.
|
23
|
-
*/
|
24
|
-
|
25
|
-
#include <stdint.h>
|
26
|
-
|
27
|
-
|
28
|
-
void sha256_compress(uint32_t state[8], const uint8_t block[64]) {
|
29
|
-
// 32-bit right rotation
|
30
|
-
#define ROR(x, i) \
|
31
|
-
(((x) << (32 - (i))) | ((x) >> (i)))
|
32
|
-
|
33
|
-
#define LOADSCHEDULE(i) \
|
34
|
-
schedule[i] = \
|
35
|
-
(uint32_t)block[i * 4 + 0] << 24 \
|
36
|
-
| (uint32_t)block[i * 4 + 1] << 16 \
|
37
|
-
| (uint32_t)block[i * 4 + 2] << 8 \
|
38
|
-
| (uint32_t)block[i * 4 + 3];
|
39
|
-
|
40
|
-
#define SCHEDULE(i) \
|
41
|
-
schedule[i] = schedule[i - 16] + schedule[i - 7] \
|
42
|
-
+ (ROR(schedule[i - 15], 7) ^ ROR(schedule[i - 15], 18) ^ (schedule[i - 15] >> 3)) \
|
43
|
-
+ (ROR(schedule[i - 2], 17) ^ ROR(schedule[i - 2], 19) ^ (schedule[i - 2] >> 10));
|
44
|
-
|
45
|
-
#define ROUND(a, b, c, d, e, f, g, h, i, k) \
|
46
|
-
h += (ROR(e, 6) ^ ROR(e, 11) ^ ROR(e, 25)) + (g ^ (e & (f ^ g))) + UINT32_C(k) + schedule[i]; \
|
47
|
-
d += h; \
|
48
|
-
h += (ROR(a, 2) ^ ROR(a, 13) ^ ROR(a, 22)) + ((a & (b | c)) | (b & c));
|
49
|
-
|
50
|
-
uint32_t schedule[64];
|
51
|
-
LOADSCHEDULE( 0)
|
52
|
-
LOADSCHEDULE( 1)
|
53
|
-
LOADSCHEDULE( 2)
|
54
|
-
LOADSCHEDULE( 3)
|
55
|
-
LOADSCHEDULE( 4)
|
56
|
-
LOADSCHEDULE( 5)
|
57
|
-
LOADSCHEDULE( 6)
|
58
|
-
LOADSCHEDULE( 7)
|
59
|
-
LOADSCHEDULE( 8)
|
60
|
-
LOADSCHEDULE( 9)
|
61
|
-
LOADSCHEDULE(10)
|
62
|
-
LOADSCHEDULE(11)
|
63
|
-
LOADSCHEDULE(12)
|
64
|
-
LOADSCHEDULE(13)
|
65
|
-
LOADSCHEDULE(14)
|
66
|
-
LOADSCHEDULE(15)
|
67
|
-
SCHEDULE(16)
|
68
|
-
SCHEDULE(17)
|
69
|
-
SCHEDULE(18)
|
70
|
-
SCHEDULE(19)
|
71
|
-
SCHEDULE(20)
|
72
|
-
SCHEDULE(21)
|
73
|
-
SCHEDULE(22)
|
74
|
-
SCHEDULE(23)
|
75
|
-
SCHEDULE(24)
|
76
|
-
SCHEDULE(25)
|
77
|
-
SCHEDULE(26)
|
78
|
-
SCHEDULE(27)
|
79
|
-
SCHEDULE(28)
|
80
|
-
SCHEDULE(29)
|
81
|
-
SCHEDULE(30)
|
82
|
-
SCHEDULE(31)
|
83
|
-
SCHEDULE(32)
|
84
|
-
SCHEDULE(33)
|
85
|
-
SCHEDULE(34)
|
86
|
-
SCHEDULE(35)
|
87
|
-
SCHEDULE(36)
|
88
|
-
SCHEDULE(37)
|
89
|
-
SCHEDULE(38)
|
90
|
-
SCHEDULE(39)
|
91
|
-
SCHEDULE(40)
|
92
|
-
SCHEDULE(41)
|
93
|
-
SCHEDULE(42)
|
94
|
-
SCHEDULE(43)
|
95
|
-
SCHEDULE(44)
|
96
|
-
SCHEDULE(45)
|
97
|
-
SCHEDULE(46)
|
98
|
-
SCHEDULE(47)
|
99
|
-
SCHEDULE(48)
|
100
|
-
SCHEDULE(49)
|
101
|
-
SCHEDULE(50)
|
102
|
-
SCHEDULE(51)
|
103
|
-
SCHEDULE(52)
|
104
|
-
SCHEDULE(53)
|
105
|
-
SCHEDULE(54)
|
106
|
-
SCHEDULE(55)
|
107
|
-
SCHEDULE(56)
|
108
|
-
SCHEDULE(57)
|
109
|
-
SCHEDULE(58)
|
110
|
-
SCHEDULE(59)
|
111
|
-
SCHEDULE(60)
|
112
|
-
SCHEDULE(61)
|
113
|
-
SCHEDULE(62)
|
114
|
-
SCHEDULE(63)
|
115
|
-
|
116
|
-
uint32_t a = state[0];
|
117
|
-
uint32_t b = state[1];
|
118
|
-
uint32_t c = state[2];
|
119
|
-
uint32_t d = state[3];
|
120
|
-
uint32_t e = state[4];
|
121
|
-
uint32_t f = state[5];
|
122
|
-
uint32_t g = state[6];
|
123
|
-
uint32_t h = state[7];
|
124
|
-
ROUND(a, b, c, d, e, f, g, h, 0, 0x428A2F98)
|
125
|
-
ROUND(h, a, b, c, d, e, f, g, 1, 0x71374491)
|
126
|
-
ROUND(g, h, a, b, c, d, e, f, 2, 0xB5C0FBCF)
|
127
|
-
ROUND(f, g, h, a, b, c, d, e, 3, 0xE9B5DBA5)
|
128
|
-
ROUND(e, f, g, h, a, b, c, d, 4, 0x3956C25B)
|
129
|
-
ROUND(d, e, f, g, h, a, b, c, 5, 0x59F111F1)
|
130
|
-
ROUND(c, d, e, f, g, h, a, b, 6, 0x923F82A4)
|
131
|
-
ROUND(b, c, d, e, f, g, h, a, 7, 0xAB1C5ED5)
|
132
|
-
ROUND(a, b, c, d, e, f, g, h, 8, 0xD807AA98)
|
133
|
-
ROUND(h, a, b, c, d, e, f, g, 9, 0x12835B01)
|
134
|
-
ROUND(g, h, a, b, c, d, e, f, 10, 0x243185BE)
|
135
|
-
ROUND(f, g, h, a, b, c, d, e, 11, 0x550C7DC3)
|
136
|
-
ROUND(e, f, g, h, a, b, c, d, 12, 0x72BE5D74)
|
137
|
-
ROUND(d, e, f, g, h, a, b, c, 13, 0x80DEB1FE)
|
138
|
-
ROUND(c, d, e, f, g, h, a, b, 14, 0x9BDC06A7)
|
139
|
-
ROUND(b, c, d, e, f, g, h, a, 15, 0xC19BF174)
|
140
|
-
ROUND(a, b, c, d, e, f, g, h, 16, 0xE49B69C1)
|
141
|
-
ROUND(h, a, b, c, d, e, f, g, 17, 0xEFBE4786)
|
142
|
-
ROUND(g, h, a, b, c, d, e, f, 18, 0x0FC19DC6)
|
143
|
-
ROUND(f, g, h, a, b, c, d, e, 19, 0x240CA1CC)
|
144
|
-
ROUND(e, f, g, h, a, b, c, d, 20, 0x2DE92C6F)
|
145
|
-
ROUND(d, e, f, g, h, a, b, c, 21, 0x4A7484AA)
|
146
|
-
ROUND(c, d, e, f, g, h, a, b, 22, 0x5CB0A9DC)
|
147
|
-
ROUND(b, c, d, e, f, g, h, a, 23, 0x76F988DA)
|
148
|
-
ROUND(a, b, c, d, e, f, g, h, 24, 0x983E5152)
|
149
|
-
ROUND(h, a, b, c, d, e, f, g, 25, 0xA831C66D)
|
150
|
-
ROUND(g, h, a, b, c, d, e, f, 26, 0xB00327C8)
|
151
|
-
ROUND(f, g, h, a, b, c, d, e, 27, 0xBF597FC7)
|
152
|
-
ROUND(e, f, g, h, a, b, c, d, 28, 0xC6E00BF3)
|
153
|
-
ROUND(d, e, f, g, h, a, b, c, 29, 0xD5A79147)
|
154
|
-
ROUND(c, d, e, f, g, h, a, b, 30, 0x06CA6351)
|
155
|
-
ROUND(b, c, d, e, f, g, h, a, 31, 0x14292967)
|
156
|
-
ROUND(a, b, c, d, e, f, g, h, 32, 0x27B70A85)
|
157
|
-
ROUND(h, a, b, c, d, e, f, g, 33, 0x2E1B2138)
|
158
|
-
ROUND(g, h, a, b, c, d, e, f, 34, 0x4D2C6DFC)
|
159
|
-
ROUND(f, g, h, a, b, c, d, e, 35, 0x53380D13)
|
160
|
-
ROUND(e, f, g, h, a, b, c, d, 36, 0x650A7354)
|
161
|
-
ROUND(d, e, f, g, h, a, b, c, 37, 0x766A0ABB)
|
162
|
-
ROUND(c, d, e, f, g, h, a, b, 38, 0x81C2C92E)
|
163
|
-
ROUND(b, c, d, e, f, g, h, a, 39, 0x92722C85)
|
164
|
-
ROUND(a, b, c, d, e, f, g, h, 40, 0xA2BFE8A1)
|
165
|
-
ROUND(h, a, b, c, d, e, f, g, 41, 0xA81A664B)
|
166
|
-
ROUND(g, h, a, b, c, d, e, f, 42, 0xC24B8B70)
|
167
|
-
ROUND(f, g, h, a, b, c, d, e, 43, 0xC76C51A3)
|
168
|
-
ROUND(e, f, g, h, a, b, c, d, 44, 0xD192E819)
|
169
|
-
ROUND(d, e, f, g, h, a, b, c, 45, 0xD6990624)
|
170
|
-
ROUND(c, d, e, f, g, h, a, b, 46, 0xF40E3585)
|
171
|
-
ROUND(b, c, d, e, f, g, h, a, 47, 0x106AA070)
|
172
|
-
ROUND(a, b, c, d, e, f, g, h, 48, 0x19A4C116)
|
173
|
-
ROUND(h, a, b, c, d, e, f, g, 49, 0x1E376C08)
|
174
|
-
ROUND(g, h, a, b, c, d, e, f, 50, 0x2748774C)
|
175
|
-
ROUND(f, g, h, a, b, c, d, e, 51, 0x34B0BCB5)
|
176
|
-
ROUND(e, f, g, h, a, b, c, d, 52, 0x391C0CB3)
|
177
|
-
ROUND(d, e, f, g, h, a, b, c, 53, 0x4ED8AA4A)
|
178
|
-
ROUND(c, d, e, f, g, h, a, b, 54, 0x5B9CCA4F)
|
179
|
-
ROUND(b, c, d, e, f, g, h, a, 55, 0x682E6FF3)
|
180
|
-
ROUND(a, b, c, d, e, f, g, h, 56, 0x748F82EE)
|
181
|
-
ROUND(h, a, b, c, d, e, f, g, 57, 0x78A5636F)
|
182
|
-
ROUND(g, h, a, b, c, d, e, f, 58, 0x84C87814)
|
183
|
-
ROUND(f, g, h, a, b, c, d, e, 59, 0x8CC70208)
|
184
|
-
ROUND(e, f, g, h, a, b, c, d, 60, 0x90BEFFFA)
|
185
|
-
ROUND(d, e, f, g, h, a, b, c, 61, 0xA4506CEB)
|
186
|
-
ROUND(c, d, e, f, g, h, a, b, 62, 0xBEF9A3F7)
|
187
|
-
ROUND(b, c, d, e, f, g, h, a, 63, 0xC67178F2)
|
188
|
-
state[0] += a;
|
189
|
-
state[1] += b;
|
190
|
-
state[2] += c;
|
191
|
-
state[3] += d;
|
192
|
-
state[4] += e;
|
193
|
-
state[5] += f;
|
194
|
-
state[6] += g;
|
195
|
-
state[7] += h;
|
196
|
-
}
|
@@ -1,56 +0,0 @@
|
|
1
|
-
#define LUA_LIB
|
2
|
-
#include <lua.h>
|
3
|
-
#include <lauxlib.h>
|
4
|
-
|
5
|
-
#ifdef _WIN32
|
6
|
-
#define WIN32_LEAN_AND_MEAN
|
7
|
-
#include <windows.h>
|
8
|
-
#else
|
9
|
-
#include <sys/utsname.h>
|
10
|
-
#endif /* _WIN32 */
|
11
|
-
|
12
|
-
static int lua_uname(lua_State *L)
|
13
|
-
{
|
14
|
-
#ifdef _WIN32
|
15
|
-
const char *name;
|
16
|
-
SYSTEM_INFO info;
|
17
|
-
lua_pushliteral(L, "Windows");
|
18
|
-
name = getenv("COMPUTERNAME");
|
19
|
-
lua_pushstring(L, name ? name : "");
|
20
|
-
memset(&info, 0, sizeof(info));
|
21
|
-
GetSystemInfo(&info);
|
22
|
-
if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
|
23
|
-
lua_pushliteral(L, "AMD64");
|
24
|
-
else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
|
25
|
-
lua_pushliteral(L, "X86");
|
26
|
-
else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM)
|
27
|
-
lua_pushliteral(L, "ARM");
|
28
|
-
else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
|
29
|
-
lua_pushliteral(L, "IA64");
|
30
|
-
else if (info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
|
31
|
-
lua_pushstring(L, "");
|
32
|
-
return 3;
|
33
|
-
#else
|
34
|
-
struct utsname info;
|
35
|
-
if (uname(&info) >= 0)
|
36
|
-
{
|
37
|
-
lua_pushstring(L, info.sysname);
|
38
|
-
lua_pushstring(L, info.nodename);
|
39
|
-
lua_pushstring(L, info.machine);
|
40
|
-
return 3;
|
41
|
-
}
|
42
|
-
lua_pushstring(L, "Unknown");
|
43
|
-
return 1;
|
44
|
-
#endif
|
45
|
-
}
|
46
|
-
|
47
|
-
static const luaL_Reg sys_utils[] = {
|
48
|
-
{"uname", lua_uname},
|
49
|
-
{NULL, NULL}
|
50
|
-
};
|
51
|
-
|
52
|
-
int luaopen_sysutils(lua_State *L) {
|
53
|
-
// luaL_checkversion(L);
|
54
|
-
luaL_register(L, "sysutils", sys_utils);
|
55
|
-
return 1;
|
56
|
-
}
|