mirror of
https://github.com/AlchemillaHQ/Sylve.git
synced 2026-06-18 01:26:36 +03:00
25 lines
557 B
Go
25 lines
557 B
Go
// SPDX-License-Identifier: BSD-2-Clause
|
|
//
|
|
// Copyright (c) 2025 The FreeBSD Foundation.
|
|
//
|
|
// This software was developed by Hayzam Sherif <hayzam@alchemilla.io>
|
|
// of Alchemilla Ventures Pvt. Ltd. <hello@alchemilla.io>,
|
|
// under sponsorship from the FreeBSD Foundation.
|
|
|
|
package utils
|
|
|
|
import (
|
|
"bytes"
|
|
"crypto/sha512"
|
|
)
|
|
|
|
func DeterministicEntropy(seed []byte) []byte {
|
|
hash := sha512.Sum512(seed)
|
|
var entropy bytes.Buffer
|
|
for i := 0; i < 1024; i++ {
|
|
h := sha512.Sum512(append(hash[:], byte(i)))
|
|
entropy.Write(h[:])
|
|
}
|
|
return entropy.Bytes()
|
|
}
|