package crypto

import (
	
	 // #nosec
	
)

// GuessDataWithHash guesses data from data_with_hash.
func ( []byte) []byte {
	// data_with_hash := SHA1(data) + data + (0-15 random bytes);
	// such that length be divisible by 16;
	if len() <= sha1.Size {
		// Data length too small.
		return nil
	}

	 := [:sha1.Size]
	for  := 0;  < 16; ++ {
		if len()- < sha1.Size {
			// End of slice reached.
			return nil
		}
		 := [sha1.Size : len()-]
		 := sha1.Sum() // #nosec
		if bytes.Equal([:], ) {
			// Found.
			return 
		}
	}
	return nil
}

func ( int) int {
	 := 16 * ( / 16)
	if  <  {
		 += 16
	}
	return 
}

// DataWithHash prepends data with SHA1(data) and 0..15 random bytes so result
// length is divisible by 16.
//
// Use GuessDataWithHash(result) to obtain data.
func ( []byte,  io.Reader) ([]byte, error) {
	 := make([]byte, paddedLen16(len()+sha1.Size))
	 := sha1.Sum() // #nosec
	copy(, [:])
	copy([sha1.Size:], )
	if ,  := io.ReadFull(, [sha1.Size+len():]);  != nil {
		return nil, 
	}
	return , nil
}