-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved CRC16-CCITT code to library. (#37)
Added Base32Hex library to allow eight flags in a single ASCII digit. (#36)
- Loading branch information
Showing
8 changed files
with
283 additions
and
142 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,13 @@ | |
## Title: GreenWall | ||
## Notes: Common communication channel as a replacement for guild chat in guild confederations. | ||
## Author: Mark Rogaski <[email protected]> | ||
## Version: 2.0.0-alpha | ||
## Version: 1.6.0-alpha | ||
## URL: https://github.com/AIE-Guild/GreenWall/releases | ||
## URL: http://wow.curse.com/downloads/wow-addons/details/greenwall.aspx | ||
## DefaultState: enabled | ||
## SavedVariablesPerCharacter: GreenWall,GreenWallLog | ||
## X-Category: Guild | ||
## X-Date: 10/15/2014 | ||
## X-Date: 10/23/2014 | ||
|
||
Lib\Load.xml | ||
Constants.lua | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--[[-------------------------------------------------------------------------- | ||
The MIT License (MIT) | ||
Copyright (c) 2014 Mark Rogaski | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
--]]-------------------------------------------------------------------------- | ||
|
||
---------------------------------------------------------------------------- | ||
-- Package Definition | ||
---------------------------------------------------------------------------- | ||
|
||
local VERSION_MAJOR = "Encoding:Base32Hex-1.0" | ||
local VERSION_MINOR = 1 | ||
local Base32Hex = LibStub:NewLibrary(VERSION_MAJOR, VERSION_MINOR) | ||
if not Base32Hex then | ||
return | ||
end | ||
|
||
--- Encode | ||
-- @param i Integer to convert. | ||
-- @return The base32hex string. | ||
function Base32Hex.Encode(i) | ||
local digit = nil | ||
local string = '' | ||
while i > 0 do | ||
local k = i % 32 | ||
if k < 10 then | ||
digit = string.char(k + 48) | ||
else | ||
digit = string.char(k + 55) | ||
end | ||
string = string .. digit | ||
end | ||
return string | ||
end | ||
|
||
|
||
--- Decode | ||
-- @param s String to convert. | ||
-- @return The integer value. | ||
function Base32Hex.Decode(s) | ||
local sum = 0 | ||
for c in string.gmatch(s, '.') do | ||
local i = string.byte(c) | ||
if i >= 48 and i < 58 then | ||
sum = sum * 32 + (i - 48) | ||
elseif i >= 65 and i < 87 then | ||
sum = sum * 32 + (i - 65) | ||
elseif i >= 97 and i < 119 then | ||
sum = sum * 32 + (i - 97) | ||
else | ||
return | ||
end | ||
end | ||
return sum | ||
end | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--[[-------------------------------------------------------------------------- | ||
The MIT License (MIT) | ||
Copyright (c) 2014 Mark Rogaski | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
--]]-------------------------------------------------------------------------- | ||
|
||
---------------------------------------------------------------------------- | ||
-- Package Definition | ||
---------------------------------------------------------------------------- | ||
|
||
local VERSION_MAJOR = "Hash:CRC:16ccitt-1.0" | ||
local VERSION_MINOR = 1 | ||
local CRC = LibStub:NewLibrary(VERSION_MAJOR, VERSION_MINOR) | ||
if not CRC then | ||
return | ||
end | ||
|
||
---------------------------------------------------------------------------- | ||
-- Imports | ||
---------------------------------------------------------------------------- | ||
|
||
local bxor, band, rshift = bit.bxor, bit.band, bit.rshift | ||
|
||
|
||
---------------------------------------------------------------------------- | ||
-- Functions | ||
---------------------------------------------------------------------------- | ||
|
||
--- CRC16-CCITT | ||
-- @param str The string to hash. | ||
-- @return The CRC hash. | ||
function CRC.Hash(str) | ||
|
||
if str == nil then | ||
str = '' | ||
end | ||
|
||
local crc = 0xffff | ||
|
||
for i = 1, #str do | ||
|
||
c = str:byte(i) | ||
crc = bxor(crc, c) | ||
|
||
for j = 1, 8 do | ||
|
||
local k = band(crc, 1) | ||
crc = rshift(crc, 1) | ||
|
||
if k ~= 0 then | ||
crc = bxor(crc, 0x8408) | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
return crc | ||
end | ||
|
This file contains 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
This file contains 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