live · mainnetoc · docs
specs · api · guides
docs / documentation

@orangecheck/stamp-core


@orangecheck/stamp-core / hashContent

Function: hashContent()

function hashContent(bytes: Uint8Array): {
  hash: string;
  length: number;
};

Defined in: stamp-core/src/stamp.ts:28

Compute {hash, length} for raw bytes. Convenience over the common sha256(bytes) pattern that prefixes with sha256: and returns lowercase hex. Pass the result to stamp({ content: hashContent(bytes), mime }) when you don't want stamp() to hash the bytes itself.

Parameters

ParameterType
bytesUint8Array

Returns

{
  hash: string;
  length: number;
}
NameTypeDefined in
hashstringstamp-core/src/stamp.ts:28
lengthnumberstamp-core/src/stamp.ts:28