MCPcopy
hub / github.com/syncthing/syncthing / NewDeviceID

Function NewDeviceID

lib/protocol/deviceid.go:46–48  ·  view source on GitHub ↗

NewDeviceID generates a new device ID from SHA256 hash of the given piece of data (usually raw certificate bytes).

(rawCert []byte)

Source from the content-addressed store, hash-verified

44// NewDeviceID generates a new device ID from SHA256 hash of the given piece
45// of data (usually raw certificate bytes).
46func NewDeviceID(rawCert []byte) DeviceID {
47 return DeviceID(sha256.Sum256(rawCert))
48}
49
50// DeviceIDFromString parses a device ID from a string. The string is expected
51// to be in the canonical format, with check digits.

Callers 15

handleConnsMethod · 0.92
validateIdentityMethod · 0.92
withConnectionPairFunction · 0.92
checkMethod · 0.92
TestGlobalOverHTTPSFunction · 0.92
TestStartupFailFunction · 0.92
startupMethod · 0.92
LoadConfigAtStartupFunction · 0.92
TestManyPeersFunction · 0.92
handleRegisterFunction · 0.92
generatePrefixedFunction · 0.92
RunMethod · 0.92

Calls 1

DeviceIDTypeAlias · 0.85

Tested by 5

withConnectionPairFunction · 0.74
TestGlobalOverHTTPSFunction · 0.74
TestStartupFailFunction · 0.74
TestManyPeersFunction · 0.74
BenchmarkAPIRequestsFunction · 0.74