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 bd8a169 commit bc0a2d3
Show file tree
Hide file tree
Showing 19 changed files with 1,506 additions and 2 deletions.
82 changes: 82 additions & 0 deletions CRC8_CDMA2000.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
unit CRC8_CDMA2000;
//CRC-8 CDMA2000
//Author: domasz
//Version: 0.1 (2022-11-17)
//Licence: MIT

interface

uses SysUtils, HasherBase;

type THasherCRC8_CDMA2000 = class(THasherbase)
private
FHash: Byte;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Byte = (
$00, $9B, $AD, $36, $C1, $5A, $6C, $F7,
$19, $82, $B4, $2F, $D8, $43, $75, $EE,
$32, $A9, $9F, $04, $F3, $68, $5E, $C5,
$2B, $B0, $86, $1D, $EA, $71, $47, $DC,
$64, $FF, $C9, $52, $A5, $3E, $08, $93,
$7D, $E6, $D0, $4B, $BC, $27, $11, $8A,
$56, $CD, $FB, $60, $97, $0C, $3A, $A1,
$4F, $D4, $E2, $79, $8E, $15, $23, $B8,
$C8, $53, $65, $FE, $09, $92, $A4, $3F,
$D1, $4A, $7C, $E7, $10, $8B, $BD, $26,
$FA, $61, $57, $CC, $3B, $A0, $96, $0D,
$E3, $78, $4E, $D5, $22, $B9, $8F, $14,
$AC, $37, $01, $9A, $6D, $F6, $C0, $5B,
$B5, $2E, $18, $83, $74, $EF, $D9, $42,
$9E, $05, $33, $A8, $5F, $C4, $F2, $69,
$87, $1C, $2A, $B1, $46, $DD, $EB, $70,
$0B, $90, $A6, $3D, $CA, $51, $67, $FC,
$12, $89, $BF, $24, $D3, $48, $7E, $E5,
$39, $A2, $94, $0F, $F8, $63, $55, $CE,
$20, $BB, $8D, $16, $E1, $7A, $4C, $D7,
$6F, $F4, $C2, $59, $AE, $35, $03, $98,
$76, $ED, $DB, $40, $B7, $2C, $1A, $81,
$5D, $C6, $F0, $6B, $9C, $07, $31, $AA,
$44, $DF, $E9, $72, $85, $1E, $28, $B3,
$C3, $58, $6E, $F5, $02, $99, $AF, $34,
$DA, $41, $77, $EC, $1B, $80, $B6, $2D,
$F1, $6A, $5C, $C7, $30, $AB, $9D, $06,
$E8, $73, $45, $DE, $29, $B2, $84, $1F,
$A7, $3C, $0A, $91, $66, $FD, $CB, $50,
$BE, $25, $13, $88, $7F, $E4, $D2, $49,
$95, $0E, $38, $A3, $54, $CF, $F9, $62,
$8C, $17, $21, $BA, $4D, $D6, $E0, $7B
);

constructor THasherCRC8_CDMA2000.Create;
begin
inherited Create;
FHash := $FF;
Check := 'DA';
end;

procedure THasherCRC8_CDMA2000.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) and $FF];
Inc(Msg);
end;
end;

function THasherCRC8_CDMA2000.Final: String;
begin

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

initialization
HasherList.RegisterHasher('CRC-8 CDMA2000', THasherCRC8_CDMA2000);

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

interface

uses SysUtils, HasherBase;

type THasherCRC8_DARC = class(THasherbase)
private
FHash: Byte;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Byte = (
$00, $72, $E4, $96, $F1, $83, $15, $67,
$DB, $A9, $3F, $4D, $2A, $58, $CE, $BC,
$8F, $FD, $6B, $19, $7E, $0C, $9A, $E8,
$54, $26, $B0, $C2, $A5, $D7, $41, $33,
$27, $55, $C3, $B1, $D6, $A4, $32, $40,
$FC, $8E, $18, $6A, $0D, $7F, $E9, $9B,
$A8, $DA, $4C, $3E, $59, $2B, $BD, $CF,
$73, $01, $97, $E5, $82, $F0, $66, $14,
$4E, $3C, $AA, $D8, $BF, $CD, $5B, $29,
$95, $E7, $71, $03, $64, $16, $80, $F2,
$C1, $B3, $25, $57, $30, $42, $D4, $A6,
$1A, $68, $FE, $8C, $EB, $99, $0F, $7D,
$69, $1B, $8D, $FF, $98, $EA, $7C, $0E,
$B2, $C0, $56, $24, $43, $31, $A7, $D5,
$E6, $94, $02, $70, $17, $65, $F3, $81,
$3D, $4F, $D9, $AB, $CC, $BE, $28, $5A,
$9C, $EE, $78, $0A, $6D, $1F, $89, $FB,
$47, $35, $A3, $D1, $B6, $C4, $52, $20,
$13, $61, $F7, $85, $E2, $90, $06, $74,
$C8, $BA, $2C, $5E, $39, $4B, $DD, $AF,
$BB, $C9, $5F, $2D, $4A, $38, $AE, $DC,
$60, $12, $84, $F6, $91, $E3, $75, $07,
$34, $46, $D0, $A2, $C5, $B7, $21, $53,
$EF, $9D, $0B, $79, $1E, $6C, $FA, $88,
$D2, $A0, $36, $44, $23, $51, $C7, $B5,
$09, $7B, $ED, $9F, $F8, $8A, $1C, $6E,
$5D, $2F, $B9, $CB, $AC, $DE, $48, $3A,
$86, $F4, $62, $10, $77, $05, $93, $E1,
$F5, $87, $11, $63, $04, $76, $E0, $92,
$2E, $5C, $CA, $B8, $DF, $AD, $3B, $49,
$7A, $08, $9E, $EC, $8B, $F9, $6F, $1D,
$A1, $D3, $45, $37, $50, $22, $B4, $C6
);

constructor THasherCRC8_DARC.Create;
begin
inherited Create;
FHash := $00;
Check := '15';
end;

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

function THasherCRC8_DARC.Final: String;
begin

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

initialization
HasherList.RegisterHasher('CRC-8 DARC', THasherCRC8_DARC);

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

interface

uses SysUtils, HasherBase;

type THasherCRC8_DVBS2 = class(THasherbase)
private
FHash: Byte;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Byte = (
$00, $D5, $7F, $AA, $FE, $2B, $81, $54,
$29, $FC, $56, $83, $D7, $02, $A8, $7D,
$52, $87, $2D, $F8, $AC, $79, $D3, $06,
$7B, $AE, $04, $D1, $85, $50, $FA, $2F,
$A4, $71, $DB, $0E, $5A, $8F, $25, $F0,
$8D, $58, $F2, $27, $73, $A6, $0C, $D9,
$F6, $23, $89, $5C, $08, $DD, $77, $A2,
$DF, $0A, $A0, $75, $21, $F4, $5E, $8B,
$9D, $48, $E2, $37, $63, $B6, $1C, $C9,
$B4, $61, $CB, $1E, $4A, $9F, $35, $E0,
$CF, $1A, $B0, $65, $31, $E4, $4E, $9B,
$E6, $33, $99, $4C, $18, $CD, $67, $B2,
$39, $EC, $46, $93, $C7, $12, $B8, $6D,
$10, $C5, $6F, $BA, $EE, $3B, $91, $44,
$6B, $BE, $14, $C1, $95, $40, $EA, $3F,
$42, $97, $3D, $E8, $BC, $69, $C3, $16,
$EF, $3A, $90, $45, $11, $C4, $6E, $BB,
$C6, $13, $B9, $6C, $38, $ED, $47, $92,
$BD, $68, $C2, $17, $43, $96, $3C, $E9,
$94, $41, $EB, $3E, $6A, $BF, $15, $C0,
$4B, $9E, $34, $E1, $B5, $60, $CA, $1F,
$62, $B7, $1D, $C8, $9C, $49, $E3, $36,
$19, $CC, $66, $B3, $E7, $32, $98, $4D,
$30, $E5, $4F, $9A, $CE, $1B, $B1, $64,
$72, $A7, $0D, $D8, $8C, $59, $F3, $26,
$5B, $8E, $24, $F1, $A5, $70, $DA, $0F,
$20, $F5, $5F, $8A, $DE, $0B, $A1, $74,
$09, $DC, $76, $A3, $F7, $22, $88, $5D,
$D6, $03, $A9, $7C, $28, $FD, $57, $82,
$FF, $2A, $80, $55, $01, $D4, $7E, $AB,
$84, $51, $FB, $2E, $7A, $AF, $05, $D0,
$AD, $78, $D2, $07, $53, $86, $2C, $F9
);

constructor THasherCRC8_DVBS2.Create;
begin
inherited Create;
FHash := $00;
Check := 'BC';
end;

procedure THasherCRC8_DVBS2.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) and $FF];
Inc(Msg);
end;
end;

function THasherCRC8_DVBS2.Final: String;
begin

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

initialization
HasherList.RegisterHasher('CRC-8 DVB-S2', THasherCRC8_DVBS2);

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

interface

uses SysUtils, HasherBase;

type THasherCRC8_GSMA = class(THasherbase)
private
FHash: Byte;
public
constructor Create; override;
procedure Update(Msg: PByte; Length: Integer); override;
function Final: String; override;
end;

implementation

var Table: array[0..255] of Byte = (
$00, $1D, $3A, $27, $74, $69, $4E, $53,
$E8, $F5, $D2, $CF, $9C, $81, $A6, $BB,
$CD, $D0, $F7, $EA, $B9, $A4, $83, $9E,
$25, $38, $1F, $02, $51, $4C, $6B, $76,
$87, $9A, $BD, $A0, $F3, $EE, $C9, $D4,
$6F, $72, $55, $48, $1B, $06, $21, $3C,
$4A, $57, $70, $6D, $3E, $23, $04, $19,
$A2, $BF, $98, $85, $D6, $CB, $EC, $F1,
$13, $0E, $29, $34, $67, $7A, $5D, $40,
$FB, $E6, $C1, $DC, $8F, $92, $B5, $A8,
$DE, $C3, $E4, $F9, $AA, $B7, $90, $8D,
$36, $2B, $0C, $11, $42, $5F, $78, $65,
$94, $89, $AE, $B3, $E0, $FD, $DA, $C7,
$7C, $61, $46, $5B, $08, $15, $32, $2F,
$59, $44, $63, $7E, $2D, $30, $17, $0A,
$B1, $AC, $8B, $96, $C5, $D8, $FF, $E2,
$26, $3B, $1C, $01, $52, $4F, $68, $75,
$CE, $D3, $F4, $E9, $BA, $A7, $80, $9D,
$EB, $F6, $D1, $CC, $9F, $82, $A5, $B8,
$03, $1E, $39, $24, $77, $6A, $4D, $50,
$A1, $BC, $9B, $86, $D5, $C8, $EF, $F2,
$49, $54, $73, $6E, $3D, $20, $07, $1A,
$6C, $71, $56, $4B, $18, $05, $22, $3F,
$84, $99, $BE, $A3, $F0, $ED, $CA, $D7,
$35, $28, $0F, $12, $41, $5C, $7B, $66,
$DD, $C0, $E7, $FA, $A9, $B4, $93, $8E,
$F8, $E5, $C2, $DF, $8C, $91, $B6, $AB,
$10, $0D, $2A, $37, $64, $79, $5E, $43,
$B2, $AF, $88, $95, $C6, $DB, $FC, $E1,
$5A, $47, $60, $7D, $2E, $33, $14, $09,
$7F, $62, $45, $58, $0B, $16, $31, $2C,
$97, $8A, $AD, $B0, $E3, $FE, $D9, $C4
);

constructor THasherCRC8_GSMA.Create;
begin
inherited Create;
FHash := $00;
Check := '37';
end;

procedure THasherCRC8_GSMA.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) and $FF];
Inc(Msg);
end;
end;

function THasherCRC8_GSMA.Final: String;
begin

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

initialization
HasherList.RegisterHasher('CRC-8 GSM-A', THasherCRC8_GSMA);

end.
Loading

0 comments on commit bc0a2d3

Please sign in to comment.