ubc

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

ubc package provides ways for SHA1 blocks to be checked for Unavoidable Bit Conditions that arise from crypto analysis attacks.

Index

Constants

View Source
const (
	CheckSize = 80

	DV_I_43_0_bit  = (uint32)(1 << 0)
	DV_I_44_0_bit  = (uint32)(1 << 1)
	DV_I_45_0_bit  = (uint32)(1 << 2)
	DV_I_46_0_bit  = (uint32)(1 << 3)
	DV_I_46_2_bit  = (uint32)(1 << 4)
	DV_I_47_0_bit  = (uint32)(1 << 5)
	DV_I_47_2_bit  = (uint32)(1 << 6)
	DV_I_48_0_bit  = (uint32)(1 << 7)
	DV_I_48_2_bit  = (uint32)(1 << 8)
	DV_I_49_0_bit  = (uint32)(1 << 9)
	DV_I_49_2_bit  = (uint32)(1 << 10)
	DV_I_50_0_bit  = (uint32)(1 << 11)
	DV_I_50_2_bit  = (uint32)(1 << 12)
	DV_I_51_0_bit  = (uint32)(1 << 13)
	DV_I_51_2_bit  = (uint32)(1 << 14)
	DV_I_52_0_bit  = (uint32)(1 << 15)
	DV_II_45_0_bit = (uint32)(1 << 16)
	DV_II_46_0_bit = (uint32)(1 << 17)
	DV_II_46_2_bit = (uint32)(1 << 18)
	DV_II_47_0_bit = (uint32)(1 << 19)
	DV_II_48_0_bit = (uint32)(1 << 20)
	DV_II_49_0_bit = (uint32)(1 << 21)
	DV_II_49_2_bit = (uint32)(1 << 22)
	DV_II_50_0_bit = (uint32)(1 << 23)
	DV_II_50_2_bit = (uint32)(1 << 24)
	DV_II_51_0_bit = (uint32)(1 << 25)
	DV_II_51_2_bit = (uint32)(1 << 26)
	DV_II_52_0_bit = (uint32)(1 << 27)
	DV_II_53_0_bit = (uint32)(1 << 28)
	DV_II_54_0_bit = (uint32)(1 << 29)
	DV_II_55_0_bit = (uint32)(1 << 30)
	DV_II_56_0_bit = (uint32)(1 << 31)
)

Variables

This section is empty.

Functions

func CalculateDvMask

func CalculateDvMask(W *[80]uint32) uint32

CalculateDvMask takes as input an expanded message block and verifies the unavoidable bitconditions for all listed DVs. It returns a dvmask where each bit belonging to a DV is set if all unavoidable bitconditions for that DV have been met.

Types

type DvInfo

type DvInfo struct {
	// DvType, DvK and DvB define the DV: I(K,B) or II(K,B) (see the paper).
	// https://marc-stevens.nl/research/papers/C13-S.pdf
	DvType uint32
	DvK    uint32
	DvB    uint32

	// TestT is the step to do the recompression from for collision detection.
	TestT uint32

	// MaskI and MaskB define the bit to check for each DV in the dvmask returned by ubc_check.
	MaskI uint32
	MaskB uint32

	// Dm is the expanded message block XOR-difference defined by the DV.
	Dm [80]uint32
}

func SHA1_dvs

func SHA1_dvs() []DvInfo

Jump to

Keyboard shortcuts

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