2022-11-01 11:22:00 +00:00
|
|
|
package crypto
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/binary"
|
|
|
|
"git.gammaspectra.live/P2Pool/moneroutil"
|
|
|
|
)
|
|
|
|
|
2022-11-05 05:29:12 +00:00
|
|
|
func GetDerivationSharedDataForOutputIndex(derivation PublicKey, outputIndex uint64) PrivateKey {
|
2022-11-05 08:33:53 +00:00
|
|
|
return PrivateKeyFromScalar(HashToScalar(derivation.AsSlice(), binary.AppendUvarint(nil, outputIndex)))
|
2022-11-01 11:22:00 +00:00
|
|
|
}
|
|
|
|
|
2022-11-05 05:29:12 +00:00
|
|
|
func GetDerivationViewTagForOutputIndex(derivation PublicKey, outputIndex uint64) uint8 {
|
2022-11-05 08:33:53 +00:00
|
|
|
h := moneroutil.Keccak256([]byte("view_tag"), derivation.AsSlice(), binary.AppendUvarint(nil, outputIndex))
|
2022-11-01 11:22:00 +00:00
|
|
|
return h[0]
|
|
|
|
}
|