crypto

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2025 License: GPL-3.0 Imports: 3 Imported by: 1

Documentation

Overview

Package crypto implements the Blizz hashing and encryption algorithms

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key uint32, data []byte)

Decrypts MPQ block information in-situ using key

func HashString

func HashString(s string, hash_type HashType) uint32

Produces a hash for any given string. (case-insensitive)

func NewBlock

func NewBlock(key uint32) (b *block)

Creates a new encryption block block satisfies the cipher.Block interface

func NewHash

func NewHash(hash_type HashType) hash.Hash32

Creates a new Blizz hash digest. This digest implements the hash.Hash32 interface.

Types

type HashType

type HashType uint8

Hash types are permutations that are used to separate different types of hashes.

const (
	HashIndex HashType = iota
	// A and B hashes are used to reduce the rate of collisions
	HashNameA
	HashNameB
	// HashEncryptKey is used when generating decryption keys from strings
	HashEncryptKey
	// HashEncryptData is used internally when encrypting data
	HashEncryptData
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL