// composeContentBlocks4 composes every content block into a HMAC-LENGTH-DATA block scheme (Kdbx v4)
composeContentBlocks4 composes every content block into a HMAC-LENGTH-DATA block scheme (Kdbx v4)
// composeContentBlocks4 composes every content block into a HMAC - LENGTH - DATA block scheme ( Kdbx v4 )
func composeContentBlocks4(w io.Writer, contentData []byte, masterSeed []byte, transformedKey []byte) {
	hmacBuilder := NewBlockHMACBuilder(masterSeed, transformedKey)
	offset := 0
	endOffset := 0
	var index = uint64(0)
	for {
		remainingLength := len(contentData[offset:])
		if remainingLength >= blockSplitRate {
			endOffset = offset + blockSplitRate
		} else {
			endOffset = offset + remainingLength
		}
		length := endOffset - offset
		data := make([]byte, length)
		copy(data, contentData[offset:endOffset])
		uLength := uint32(length)
		blockHMAC := hmacBuilder.BuildHMAC(index, uLength, data)
		w.Write(blockHMAC)
		binary.Write(w, binary.LittleEndian, uLength)
		w.Write(data)
		offset = endOffset
		if length == 0 {
			break
		}
		index += 1
	}
	binary.Write(w, binary.LittleEndian, [32]byte{})
	binary.Write(w, binary.LittleEndian, uint32(0))
}
func composeContentBlocks4 ( w io . Writer , contentData [ ] byte , masterSeed [ ] byte , transformedKey [ ] byte ) { hmacBuilder := NewBlockHMACBuilder ( masterSeed , transformedKey ) offset := 0 endOffset := 0 var index = uint64 ( 0 ) for { remainingLength := len ( contentData [ offset : ] ) if remainingLength >= blockSplitRate { endOffset = offset + blockSplitRate } else { endOffset = offset + remainingLength } length := endOffset - offset data := make ( [ ] byte , length ) copy ( data , contentData [ offset : endOffset ] ) uLength := uint32 ( length ) blockHMAC := hmacBuilder . BuildHMAC ( index , uLength , data ) w . Write ( blockHMAC ) binary . Write ( w , binary . LittleEndian , uLength ) w . Write ( data ) offset = endOffset if length == 0 { break } index += 1 } binary . Write ( w , binary . LittleEndian , [ 32 ] byte { } ) binary . Write ( w , binary . LittleEndian , uint32 ( 0 ) ) }
composeContentBlocks4 composes every content block into a HMAC-LENGTH-DATA block scheme (Kdbx v4)
composeContentBlocks4 composes every content block into a HMAC - LENGTH - DATA block scheme ( Kdbx v4 )