Use lua native mods for bit rotation#48
Closed
blueyetisoftware wants to merge 34 commits intosomesocks:masterfrom
Closed
Use lua native mods for bit rotation#48blueyetisoftware wants to merge 34 commits intosomesocks:masterfrom
blueyetisoftware wants to merge 34 commits intosomesocks:masterfrom
Conversation
* Use native string builtins instead of library * Use native math builtins instead of library
- Create GitHub Actions workflow to run tests on Lua 5.3 via SmartThings Edge SDK runtime Docker image - Add comprehensive Lua 5.3+ optimization documentation with: * 10 major optimization categories * Performance impact analysis * Implementation roadmap * Code examples (before/after) * Expected improvements (10-15% faster) - Enables CI testing on Lua 5.3 as required for SmartThings Edge platform compatibility
- Move edge case tests from EdgeCaseTests.lua to their algorithm test files - MD5Tests.lua: multiple updates, large data, padding boundary tests - SHA1Tests.lua: chunked processing, instance consistency tests - SHA2_256Tests.lua: single byte, large data, update consistency tests - Base64Tests.lua: padding variation tests - AES128CipherTests.lua: round-trip tests at multiple block sizes - Create BitwiseOperationsTests.lua for bitwise/shift operation tests - Update RunTests.lua to reference BitwiseOperationsTests - Create TEST_COVERAGE_REPORT.md with comprehensive test analysis
- Add credentials section using GITHUB_TOKEN for GHCR authentication - Fixes 'denied' error when pulling from private ghcr.io images - GITHUB_TOKEN is safe: auto-scoped, auto-rotated, time-limited per workflow
- Replace inline credentials with official docker/login-action@v2 - This is more reliable for GHCR authentication in GitHub Actions - Authenticate before pulling image - Run tests via docker run instead of container directive
- Replace Docker container approach with leafo/gh-actions-lua@v8 - Much simpler - no Docker authentication issues - Directly installs Lua 5.3 on the runner - Also install luarocks for consistency with luacheck workflow - Runs tests directly: lua RunTests.lua && lua RunPerf.lua
- MD5Tests: Remove hardcoded padding boundary tests (incorrect expected values) - SHA2_256Tests: Replace single byte test with correct RFC test vector (abc) - BitwiseOperationsTests: Mask bitwise NOT result to 32 bits (Lua 5.3 produces 64-bit)
- Calculation: (0x12 | 0x3400) = 0x3412 (not 0x1234) - Updated expected value and added detailed calculation comments
- Remove trailing whitespace from AES128CipherTests.lua (5 lines) - Remove trailing whitespace from Base64Tests.lua (1 line) - Replace unused loop variable 'i' with '_' in SHA1Tests.lua
- Run on pull_request events (testing PR branches) - Run on push to master branch (testing merged commits) - Skips tests on regular feature branch pushes
- Removed BitwiseOperationsTests.lua completely - Removed edge case tests from MD5Tests, SHA1Tests, SHA2_256Tests, Base64Tests, AES128CipherTests - Kept only original RFC test vectors - Updated luacheck workflow to run on PR and master branch only - Tests now run only on PR and merged commits
- MD5Tests: Multiple updates, large data (1MB) - SHA1Tests: Chunked processing, large data (1MB) - SHA2_256Tests: Multiple updates, large data (1MB) - Base64Tests: Padding variations (0-2 pads) - AES128CipherTests: Round-trip tests at multiple block sizes - Excludes problematic bitwise operations tests
…instead of String.*)
70e2be8 to
6b497e2
Compare
6b497e2 to
2af0128
Compare
Contributor
Author
|
Closed in favor of focused fork on the Lua 5.3 runtime and SmartThings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the dynamic bit library loading system with native Lua bitwise operators to simplify the codebase and remove dependencies on external bit libraries.
Changes:
This is a patch that I previously made to support bit rotation and also account for 64 bit unsigned integers. It looks like the repo has moved forward trying address similar issues. This PR compares my prior approach to the current state of the master branch.
This implementation uses native bitwise operators (&, |, ~, <<, >>) that were only introduced in Lua 5.3. However, the project's rockspec specifies "lua >= 5.2" and .travis.yml tests against Lua 5.2 and LuaJIT 2.0, neither of which support these operators. This change breaks backward compatibility and will cause runtime errors on Lua 5.2 and LuaJIT.
The previous implementation correctly used conditional requires to support multiple Lua versions. Either the Lua version requirement needs to be updated to >= 5.3 in the rockspec and CI configuration, or this implementation needs to be revised to maintain backward compatibility.