Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalVault authored Nov 17, 2022
1 parent bc0a2d3 commit 9678e38
Show file tree
Hide file tree
Showing 37 changed files with 2,753 additions and 5 deletions.
82 changes: 82 additions & 0 deletions CRC16_CMS.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
unit CRC16_CMS;
//CRC-16 CMS
//Author: domasz
//Version: 0.1 (2022-11-17)
//Licence: MIT

interface

uses SysUtils, HasherBase;

type THasherCRC16_CMS = class(THasherBase)
private
FHash: Word;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Word = (
$0000, $8005, $800F, $000A, $801B, $001E, $0014, $8011,
$8033, $0036, $003C, $8039, $0028, $802D, $8027, $0022,
$8063, $0066, $006C, $8069, $0078, $807D, $8077, $0072,
$0050, $8055, $805F, $005A, $804B, $004E, $0044, $8041,
$80C3, $00C6, $00CC, $80C9, $00D8, $80DD, $80D7, $00D2,
$00F0, $80F5, $80FF, $00FA, $80EB, $00EE, $00E4, $80E1,
$00A0, $80A5, $80AF, $00AA, $80BB, $00BE, $00B4, $80B1,
$8093, $0096, $009C, $8099, $0088, $808D, $8087, $0082,
$8183, $0186, $018C, $8189, $0198, $819D, $8197, $0192,
$01B0, $81B5, $81BF, $01BA, $81AB, $01AE, $01A4, $81A1,
$01E0, $81E5, $81EF, $01EA, $81FB, $01FE, $01F4, $81F1,
$81D3, $01D6, $01DC, $81D9, $01C8, $81CD, $81C7, $01C2,
$0140, $8145, $814F, $014A, $815B, $015E, $0154, $8151,
$8173, $0176, $017C, $8179, $0168, $816D, $8167, $0162,
$8123, $0126, $012C, $8129, $0138, $813D, $8137, $0132,
$0110, $8115, $811F, $011A, $810B, $010E, $0104, $8101,
$8303, $0306, $030C, $8309, $0318, $831D, $8317, $0312,
$0330, $8335, $833F, $033A, $832B, $032E, $0324, $8321,
$0360, $8365, $836F, $036A, $837B, $037E, $0374, $8371,
$8353, $0356, $035C, $8359, $0348, $834D, $8347, $0342,
$03C0, $83C5, $83CF, $03CA, $83DB, $03DE, $03D4, $83D1,
$83F3, $03F6, $03FC, $83F9, $03E8, $83ED, $83E7, $03E2,
$83A3, $03A6, $03AC, $83A9, $03B8, $83BD, $83B7, $03B2,
$0390, $8395, $839F, $039A, $838B, $038E, $0384, $8381,
$0280, $8285, $828F, $028A, $829B, $029E, $0294, $8291,
$82B3, $02B6, $02BC, $82B9, $02A8, $82AD, $82A7, $02A2,
$82E3, $02E6, $02EC, $82E9, $02F8, $82FD, $82F7, $02F2,
$02D0, $82D5, $82DF, $02DA, $82CB, $02CE, $02C4, $82C1,
$8243, $0246, $024C, $8249, $0258, $825D, $8257, $0252,
$0270, $8275, $827F, $027A, $826B, $026E, $0264, $8261,
$0220, $8225, $822F, $022A, $823B, $023E, $0234, $8231,
$8213, $0216, $021C, $8219, $0208, $820D, $8207, $0202
);

constructor THasherCRC16_CMS.Create;
begin
inherited Create;
FHash := $FFFF;
Check := 'AEE7';
end;

procedure THasherCRC16_CMS.Update(Msg: PByte; Length: Integer);
var i: Integer;
begin
for i:=0 to Length-1 do begin
FHash := (FHash shl 8) xor Table[(Msg^ xor (FHash shr 8)) and $FF];
Inc(Msg);
end;
end;

function THasherCRC16_CMS.Final: String;
begin

Result := IntToHex(FHash, 4);
end;

initialization
HasherList.RegisterHasher('CRC-16 CMS', THasherCRC16_CMS);

end.
82 changes: 82 additions & 0 deletions CRC16_DDS110.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
unit CRC16_DDS110;
//CRC-16 DDS-110
//Author: domasz
//Version: 0.1 (2022-11-17)
//Licence: MIT

interface

uses SysUtils, HasherBase;

type THasherCRC16_DDS110 = class(THasherBase)
private
FHash: Word;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Word = (
$0000, $8005, $800F, $000A, $801B, $001E, $0014, $8011,
$8033, $0036, $003C, $8039, $0028, $802D, $8027, $0022,
$8063, $0066, $006C, $8069, $0078, $807D, $8077, $0072,
$0050, $8055, $805F, $005A, $804B, $004E, $0044, $8041,
$80C3, $00C6, $00CC, $80C9, $00D8, $80DD, $80D7, $00D2,
$00F0, $80F5, $80FF, $00FA, $80EB, $00EE, $00E4, $80E1,
$00A0, $80A5, $80AF, $00AA, $80BB, $00BE, $00B4, $80B1,
$8093, $0096, $009C, $8099, $0088, $808D, $8087, $0082,
$8183, $0186, $018C, $8189, $0198, $819D, $8197, $0192,
$01B0, $81B5, $81BF, $01BA, $81AB, $01AE, $01A4, $81A1,
$01E0, $81E5, $81EF, $01EA, $81FB, $01FE, $01F4, $81F1,
$81D3, $01D6, $01DC, $81D9, $01C8, $81CD, $81C7, $01C2,
$0140, $8145, $814F, $014A, $815B, $015E, $0154, $8151,
$8173, $0176, $017C, $8179, $0168, $816D, $8167, $0162,
$8123, $0126, $012C, $8129, $0138, $813D, $8137, $0132,
$0110, $8115, $811F, $011A, $810B, $010E, $0104, $8101,
$8303, $0306, $030C, $8309, $0318, $831D, $8317, $0312,
$0330, $8335, $833F, $033A, $832B, $032E, $0324, $8321,
$0360, $8365, $836F, $036A, $837B, $037E, $0374, $8371,
$8353, $0356, $035C, $8359, $0348, $834D, $8347, $0342,
$03C0, $83C5, $83CF, $03CA, $83DB, $03DE, $03D4, $83D1,
$83F3, $03F6, $03FC, $83F9, $03E8, $83ED, $83E7, $03E2,
$83A3, $03A6, $03AC, $83A9, $03B8, $83BD, $83B7, $03B2,
$0390, $8395, $839F, $039A, $838B, $038E, $0384, $8381,
$0280, $8285, $828F, $028A, $829B, $029E, $0294, $8291,
$82B3, $02B6, $02BC, $82B9, $02A8, $82AD, $82A7, $02A2,
$82E3, $02E6, $02EC, $82E9, $02F8, $82FD, $82F7, $02F2,
$02D0, $82D5, $82DF, $02DA, $82CB, $02CE, $02C4, $82C1,
$8243, $0246, $024C, $8249, $0258, $825D, $8257, $0252,
$0270, $8275, $827F, $027A, $826B, $026E, $0264, $8261,
$0220, $8225, $822F, $022A, $823B, $023E, $0234, $8231,
$8213, $0216, $021C, $8219, $0208, $820D, $8207, $0202
);

constructor THasherCRC16_DDS110.Create;
begin
inherited Create;
FHash := $800D;
Check := '9ECF';
end;

procedure THasherCRC16_DDS110.Update(Msg: PByte; Length: Integer);
var i: Integer;
begin
for i:=0 to Length-1 do begin
FHash := (FHash shl 8) xor Table[(Msg^ xor (FHash shr 8)) and $FF];
Inc(Msg);
end;
end;

function THasherCRC16_DDS110.Final: String;
begin

Result := IntToHex(FHash, 4);
end;

initialization
HasherList.RegisterHasher('CRC-16 DDS-110', THasherCRC16_DDS110);

end.
82 changes: 82 additions & 0 deletions CRC16_DECTR.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
unit CRC16_DECTR;
//CRC-16 DECT-R
//Author: domasz
//Version: 0.1 (2022-11-17)
//Licence: MIT

interface

uses SysUtils, HasherBase;

type THasherCRC16_DECTR = class(THasherBase)
private
FHash: Word;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Word = (
$0000, $0589, $0B12, $0E9B, $1624, $13AD, $1D36, $18BF,
$2C48, $29C1, $275A, $22D3, $3A6C, $3FE5, $317E, $34F7,
$5890, $5D19, $5382, $560B, $4EB4, $4B3D, $45A6, $402F,
$74D8, $7151, $7FCA, $7A43, $62FC, $6775, $69EE, $6C67,
$B120, $B4A9, $BA32, $BFBB, $A704, $A28D, $AC16, $A99F,
$9D68, $98E1, $967A, $93F3, $8B4C, $8EC5, $805E, $85D7,
$E9B0, $EC39, $E2A2, $E72B, $FF94, $FA1D, $F486, $F10F,
$C5F8, $C071, $CEEA, $CB63, $D3DC, $D655, $D8CE, $DD47,
$67C9, $6240, $6CDB, $6952, $71ED, $7464, $7AFF, $7F76,
$4B81, $4E08, $4093, $451A, $5DA5, $582C, $56B7, $533E,
$3F59, $3AD0, $344B, $31C2, $297D, $2CF4, $226F, $27E6,
$1311, $1698, $1803, $1D8A, $0535, $00BC, $0E27, $0BAE,
$D6E9, $D360, $DDFB, $D872, $C0CD, $C544, $CBDF, $CE56,
$FAA1, $FF28, $F1B3, $F43A, $EC85, $E90C, $E797, $E21E,
$8E79, $8BF0, $856B, $80E2, $985D, $9DD4, $934F, $96C6,
$A231, $A7B8, $A923, $ACAA, $B415, $B19C, $BF07, $BA8E,
$CF92, $CA1B, $C480, $C109, $D9B6, $DC3F, $D2A4, $D72D,
$E3DA, $E653, $E8C8, $ED41, $F5FE, $F077, $FEEC, $FB65,
$9702, $928B, $9C10, $9999, $8126, $84AF, $8A34, $8FBD,
$BB4A, $BEC3, $B058, $B5D1, $AD6E, $A8E7, $A67C, $A3F5,
$7EB2, $7B3B, $75A0, $7029, $6896, $6D1F, $6384, $660D,
$52FA, $5773, $59E8, $5C61, $44DE, $4157, $4FCC, $4A45,
$2622, $23AB, $2D30, $28B9, $3006, $358F, $3B14, $3E9D,
$0A6A, $0FE3, $0178, $04F1, $1C4E, $19C7, $175C, $12D5,
$A85B, $ADD2, $A349, $A6C0, $BE7F, $BBF6, $B56D, $B0E4,
$8413, $819A, $8F01, $8A88, $9237, $97BE, $9925, $9CAC,
$F0CB, $F542, $FBD9, $FE50, $E6EF, $E366, $EDFD, $E874,
$DC83, $D90A, $D791, $D218, $CAA7, $CF2E, $C1B5, $C43C,
$197B, $1CF2, $1269, $17E0, $0F5F, $0AD6, $044D, $01C4,
$3533, $30BA, $3E21, $3BA8, $2317, $269E, $2805, $2D8C,
$41EB, $4462, $4AF9, $4F70, $57CF, $5246, $5CDD, $5954,
$6DA3, $682A, $66B1, $6338, $7B87, $7E0E, $7095, $751C
);

constructor THasherCRC16_DECTR.Create;
begin
inherited Create;
FHash := $0000;
Check := '007E';
end;

procedure THasherCRC16_DECTR.Update(Msg: PByte; Length: Integer);
var i: Integer;
begin
for i:=0 to Length-1 do begin
FHash := (FHash shl 8) xor Table[(Msg^ xor (FHash shr 8)) and $FF];
Inc(Msg);
end;
end;

function THasherCRC16_DECTR.Final: String;
begin
FHash := FHash xor $0001;
Result := IntToHex(FHash, 4);
end;

initialization
HasherList.RegisterHasher('CRC-16 DECT-R', THasherCRC16_DECTR);

end.
82 changes: 82 additions & 0 deletions CRC16_DECTX.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
unit CRC16_DECTX;
//CRC-16 DECT-X
//Author: domasz
//Version: 0.1 (2022-11-17)
//Licence: MIT

interface

uses SysUtils, HasherBase;

type THasherCRC16_DECTX = class(THasherBase)
private
FHash: Word;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Word = (
$0000, $0589, $0B12, $0E9B, $1624, $13AD, $1D36, $18BF,
$2C48, $29C1, $275A, $22D3, $3A6C, $3FE5, $317E, $34F7,
$5890, $5D19, $5382, $560B, $4EB4, $4B3D, $45A6, $402F,
$74D8, $7151, $7FCA, $7A43, $62FC, $6775, $69EE, $6C67,
$B120, $B4A9, $BA32, $BFBB, $A704, $A28D, $AC16, $A99F,
$9D68, $98E1, $967A, $93F3, $8B4C, $8EC5, $805E, $85D7,
$E9B0, $EC39, $E2A2, $E72B, $FF94, $FA1D, $F486, $F10F,
$C5F8, $C071, $CEEA, $CB63, $D3DC, $D655, $D8CE, $DD47,
$67C9, $6240, $6CDB, $6952, $71ED, $7464, $7AFF, $7F76,
$4B81, $4E08, $4093, $451A, $5DA5, $582C, $56B7, $533E,
$3F59, $3AD0, $344B, $31C2, $297D, $2CF4, $226F, $27E6,
$1311, $1698, $1803, $1D8A, $0535, $00BC, $0E27, $0BAE,
$D6E9, $D360, $DDFB, $D872, $C0CD, $C544, $CBDF, $CE56,
$FAA1, $FF28, $F1B3, $F43A, $EC85, $E90C, $E797, $E21E,
$8E79, $8BF0, $856B, $80E2, $985D, $9DD4, $934F, $96C6,
$A231, $A7B8, $A923, $ACAA, $B415, $B19C, $BF07, $BA8E,
$CF92, $CA1B, $C480, $C109, $D9B6, $DC3F, $D2A4, $D72D,
$E3DA, $E653, $E8C8, $ED41, $F5FE, $F077, $FEEC, $FB65,
$9702, $928B, $9C10, $9999, $8126, $84AF, $8A34, $8FBD,
$BB4A, $BEC3, $B058, $B5D1, $AD6E, $A8E7, $A67C, $A3F5,
$7EB2, $7B3B, $75A0, $7029, $6896, $6D1F, $6384, $660D,
$52FA, $5773, $59E8, $5C61, $44DE, $4157, $4FCC, $4A45,
$2622, $23AB, $2D30, $28B9, $3006, $358F, $3B14, $3E9D,
$0A6A, $0FE3, $0178, $04F1, $1C4E, $19C7, $175C, $12D5,
$A85B, $ADD2, $A349, $A6C0, $BE7F, $BBF6, $B56D, $B0E4,
$8413, $819A, $8F01, $8A88, $9237, $97BE, $9925, $9CAC,
$F0CB, $F542, $FBD9, $FE50, $E6EF, $E366, $EDFD, $E874,
$DC83, $D90A, $D791, $D218, $CAA7, $CF2E, $C1B5, $C43C,
$197B, $1CF2, $1269, $17E0, $0F5F, $0AD6, $044D, $01C4,
$3533, $30BA, $3E21, $3BA8, $2317, $269E, $2805, $2D8C,
$41EB, $4462, $4AF9, $4F70, $57CF, $5246, $5CDD, $5954,
$6DA3, $682A, $66B1, $6338, $7B87, $7E0E, $7095, $751C
);

constructor THasherCRC16_DECTX.Create;
begin
inherited Create;
FHash := $0000;
Check := '007F';
end;

procedure THasherCRC16_DECTX.Update(Msg: PByte; Length: Integer);
var i: Integer;
begin
for i:=0 to Length-1 do begin
FHash := (FHash shl 8) xor Table[(Msg^ xor (FHash shr 8)) and $FF];
Inc(Msg);
end;
end;

function THasherCRC16_DECTX.Final: String;
begin

Result := IntToHex(FHash, 4);
end;

initialization
HasherList.RegisterHasher('CRC-16 DECT-X', THasherCRC16_DECTX);

end.
Loading

0 comments on commit 9678e38

Please sign in to comment.