Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func EqualSumCastagnoli ¶
EqualSumECMA compares CRC32 hash using crc32.Castagnoli table. It returns if the sum matches to the hash of b.
func EqualSumIEEE ¶
EqualSumIEEE compares CRC32 hash using crc32.IEEE table. It returns if the sum matches to the hash of b.
func EqualSumKoopman ¶
EqualSumECMA compares CRC32 hash using crc32.Koopman table. It returns if the sum matches to the hash of b.
func SumCastagnoli ¶
SumCastagnoli returns CRC32 hash using crc32.Castagnoli table. It uses hash/crc32.New.
Example ¶
package main import ( "encoding/hex" "fmt" "github.com/aileron-projects/go/zhash/zcrc32" ) func main() { // Calculate CRC32 hash using [crc32.Castagnoli] table. // Validation data can be generated with: // - https://www.sunshine2k.de/coding/javascript/crc/crc_js.html // - https://crccalc.com/?crc=Hello%20Go!&method=CRC-32&datatype=ascii&outtype=hex sum := zcrc32.SumCastagnoli([]byte("Hello Go!")) encoded := hex.EncodeToString(sum) fmt.Println(len(sum), encoded) }
Output: 4 c83c2422
func SumIEEE ¶
SumIEEE returns CRC32 hash using crc32.IEEE table. It uses hash/crc32.New.
Example ¶
package main import ( "encoding/hex" "fmt" "github.com/aileron-projects/go/zhash/zcrc32" ) func main() { // Calculate CRC32 hash using [crc32.IEEE] table. // Validation data can be generated with: // - https://www.sunshine2k.de/coding/javascript/crc/crc_js.html // - https://crccalc.com/?crc=Hello%20Go!&method=CRC-32&datatype=ascii&outtype=hex sum := zcrc32.SumIEEE([]byte("Hello Go!")) encoded := hex.EncodeToString(sum) fmt.Println(len(sum), encoded) }
Output: 4 48e1410f
func SumKoopman ¶
SumKoopman returns CRC32 hash using crc32.Koopman table. It uses hash/crc32.New.
Example ¶
package main import ( "encoding/hex" "fmt" "github.com/aileron-projects/go/zhash/zcrc32" ) func main() { sum := zcrc32.SumKoopman([]byte("Hello Go!")) encoded := hex.EncodeToString(sum) fmt.Println(len(sum), encoded) }
Output: 4 1f83620a
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.