dcc2

package
v0.802.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package dcc2 implements Domain Cached Credentials v2 (DCC2 / MS-Cache v2 / mscash2, hashcat mode 2100): the format Windows (Vista / Server 2008+) uses to cache domain logons locally, dumped from a compromised workstation's SECURITY registry hive (HKLM\SECURITY\Cache, e.g. via impacket secretsdump). Unlike an NT hash a DCC2 cannot be passed-the-hash — it is an offline-crack- only credential — so the compute/verify side completes the credential toolkit: hash_identify recognises $DCC2$ (mode 2100) and hash_crack attacks it, but neither could produce or check one. Pure offline compute from operator-supplied strings; no network or device.

Algorithm

DCC1 = MD4( MD4(password‖UTF-16LE) ‖ lower(username)‖UTF-16LE )   (= MS-Cache v1)
DCC2 = PBKDF2-HMAC-SHA1( DCC1, lower(username)‖UTF-16LE, iterations, 16 )

The username (lowercased, UTF-16LE) is the PBKDF2 salt; the default iteration count is 10240. The stored form is `$DCC2$<iterations>#<username>#<hex>`.

Wrap-vs-native judgement

Native. It composes two in-tree primitives — internal/nthash.MD4 (the RFC-1320-verified MD4 behind nt_hash) and internal/wpa.PBKDF2 (the generic PBKDF2 behind pbkdf2_password / wpa_pmk_derive / postgres_scram) — plus UTF-16LE encoding. There is nothing to wrap; consistent with the other in-tree credential computes owning their crypto.

Verifiable / no confidently-wrong output

Strongest verification class — gated byte-for-byte against the canonical hashcat mode-2100 example $DCC2$10240#tom#e4e938d12fe5974dc42a90120bd9c90f (password "hashcat"), the independent anchor, plus pycryptodome-confirmed vectors. A malformed hash (wrong prefix / field count / iteration count / non-hex) is rejected with an error, never silently "verified".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute(username, password string, iterations int) (string, error)

Compute returns the DCC2 stored value for (username, password). iterations <= 0 selects the default of 10240.

Types

type Parsed

type Parsed struct {
	Iterations int
	Username   string
	Hash       string // 32 lowercase hex chars
}

Parsed is a decomposed DCC2 hash.

func Parse

func Parse(s string) (*Parsed, error)

Parse decomposes a `$DCC2$<iterations>#<username>#<hex>` string.

type Result

type Result struct {
	Matched    bool   `json:"matched"`
	Username   string `json:"username"`
	Iterations int    `json:"iterations"`
}

Result is the outcome of verifying a candidate password.

func Verify

func Verify(password, hash string) (*Result, error)

Verify reports whether password produces the given $DCC2$ hash (the username and iteration count are taken from the hash). Compared constant-time.

Jump to

Keyboard shortcuts

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