package obfuscated2

import (
	
	
	

	

	
)

type keys struct {
	header  []byte
	encrypt cipher.Stream
	decrypt cipher.Stream
}

func ( *keys) (,  []byte) error {
	// preallocate 256 bit key + 16 byte secret
	const  = 32 + 16

	 := append(make([]byte, 0, ), [8:40]...)
	 := append(make([]byte, 0, 16), [40:56]...)

	 := getDecryptInit()
	 := append(make([]byte, 0, ), [:32]...)
	 := append(make([]byte, 0, 16), [32:48]...)

	if len() > 0 {
		if len() < 16 {
			return errors.Errorf("invalid secret size %d", len())
		}
		 = [0:16]

		 = crypto.SHA256(, )
		 = crypto.SHA256(, )
	}

	var  error
	.encrypt,  = createCTR(, )
	if  != nil {
		return 
	}

	.decrypt,  = createCTR(, )
	if  != nil {
		return 
	}

	return nil
}

func ( io.Reader,  [4]byte,  []byte,  int) (keys, error) {
	,  := generateInit()
	if  != nil {
		return keys{}, 
	}

	var  keys
	if  := .createStreams([:], );  != nil {
		return keys{}, 
	}

	copy([56:60], [:])
	binary.LittleEndian.PutUint16([60:62], uint16())

	var  [64]byte
	.encrypt.XORKeyStream([:], [:])
	.header = make([]byte, 64)
	copy(.header, [0:56])
	copy(.header[56:], [56:56+8])

	return , nil
}