public class CRC16
extends java.lang.Object
implements java.util.zip.Checksum
C言語によるアルゴリズム辞典 奥村晴彦著 技術評論社 ISBN4-87408-414-1 C3055 2400円(購入当時)によった。
-- revision history --
$Log: CRC16.java,v $
Revision 1.0 2002/07/24 00:00:00 dangan
add to version control
[maintanance]
ソース整備
タブ廃止
ライセンス文の変更
| Modifier and Type | Field and Description |
|---|---|
static int |
CCITT_INIT
CCITT の X.25という規格の crc の初期値。
|
static int |
CCITT_POLY
CCITT の X.25という規格の
多項式 x^16 + x^12 + x^5 + 1 をビット表現にしたもの。
|
static int |
CRC_ANSY_INIT
LHAで使用される crc の初期値。
作者が勝手に設定した値であり、
CRC-ANSY でこの値が初期値として
定められているかは知らない。
|
static int |
CRC_ANSY_POLY
CRC-ANSY または CRC-16 として有名な
多項式 x^16 + x^15 + x^2 + 1 をビット表現にしたもの。
|
static int |
DefaultINIT
LHAで通常使用される、という意味でデフォルトのcrcの初期値。
CRC16.CRC_ANSY_INIT と同等である。
|
static int |
DefaultPOLY
LHAで通常使用される、という意味でデフォルトのCRC多項式。
CRC16.CRC_ANSY_POLY と同等である。
|
| Constructor and Description |
|---|
CRC16()
LHAで使用される 多項式と初期値を持つ CRC16を生成する。
|
CRC16(int poly)
poly で指定される 多項式を持つ CRC16を生成する。
初期値は poly が CRC16.CCITT_POLY であれば
CRC16.CCITT_INIT を そうでなければ
CRC16.DefaultINIT を使用する。
|
CRC16(int[] crcTable,
int init)
crcTable で指定される CRC算出用表と
initで指定される初期値を持つ CRC16を作成する。
|
CRC16(int poly,
int init)
poly で指定される 多項式と initで指定される初期値を持つ
CRC16を生成する。
|
| Modifier and Type | Method and Description |
|---|---|
long |
getValue()
crc 値を得る。
crc 値は 2バイトの値であり、
0x0000〜0xFFFFにマップされる。
|
static int[] |
makeCrcTable(int poly)
CRC値算出用の 表を作成する。
|
void |
reset()
crc 値を初期値に設定しなおす。
|
void |
update(byte[] buffer)
buffer で指定したバイト配列で crc の値を更新する。
|
void |
update(byte[] buffer,
int index,
int length)
buffer で指定したバイト配列で crc の値を更新する。
|
void |
update(int byte8)
byte8 で指定される 1バイトのデータで crcの値を更新する。
|
public static final int CRC_ANSY_POLY
public static final int CRC_ANSY_INIT
public static final int CCITT_POLY
public static final int CCITT_INIT
public static final int DefaultPOLY
public static final int DefaultINIT
public CRC16()
public CRC16(int poly)
poly - CRC16算出に使用する多項式のビット表現public CRC16(int poly,
int init)
poly - CRC16算出に使用する多項式のビット表現init - crc の初期値public CRC16(int[] crcTable,
int init)
crcTable - CRC16算出に使用する表init - crc の初期値public void update(int byte8)
update in interface java.util.zip.Checksumbyte8 - crcを更新する 1バイトのデータpublic void update(byte[] buffer)
buffer - crcを更新する データを持つバイト配列public void update(byte[] buffer,
int index,
int length)
update in interface java.util.zip.Checksumbuffer - crcを更新する データを持つバイト配列index - データの開始位置length - チェックサムの更新に使うバイト数public void reset()
reset in interface java.util.zip.Checksumpublic long getValue()
getValue in interface java.util.zip.Checksumpublic static int[] makeCrcTable(int poly)
poly - CRC算出用の多項式
When you found typographical errors or omissions, Please mail to cqw10305@nifty.com
The company name and product name which are used in this document, it is the trademark or registered trademark of each company generally.
Copyright © 2001-2002 Michel Ishizuka. All Rights Reserved.