// Separated from the above for testing purposes; deterministic ciphertext. func encryptFileToFileInfo(DI *taber.DecryptInfo, filename string, filecontents []byte) (FI *FileInfo, ciphertext []byte, err error) { var hash [32]byte ciphertext, err = DI.Encrypt(filename, filecontents) if err != nil { return nil, nil, err } hash = blake2s.Sum256(ciphertext) FI = new(FileInfo) FI.FileKey = DI.Key FI.FileNonce = DI.BaseNonce FI.FileHash = hash[:] return FI, ciphertext, nil }