package dns

import (
	
	
	
)

// identityHash will not hash, it only buffers the data written into it and returns it as-is.
type identityHash struct {
	b *bytes.Buffer
}

// Implement the hash.Hash interface.

func ( identityHash) ( []byte) (int, error) { return .b.Write() }
func ( identityHash) () int                   { return .b.Len() }
func ( identityHash) () int              { return 1024 }
func ( identityHash) ()                      { .b.Reset() }
func ( identityHash) ( []byte) []byte         { return append(, .b.Bytes()...) }

func hashFromAlgorithm( uint8) (hash.Hash, crypto.Hash, error) {
	,  := AlgorithmToHash[]
	if ! {
		return nil, 0, ErrAlg
	}
	if  == 0 {
		return identityHash{b: &bytes.Buffer{}}, , nil
	}
	return .New(), , nil
}