Computes a 64‑bit hash using the algorithm specified by HashAlgorithmAttribute on the concrete type.
100 {
101 long _hash = 0;
102
103
104 var attr = (HashAlgorithmAttribute?)Attribute.GetCustomAttribute(this.GetType(), typeof(HashAlgorithmAttribute));
105 if ( attr == null ) {
106 _hash = base.GetHashCode();
107 } else {
108
109 FixedVector<byte> input = ToBytes();
110
111
112 object? inst = null;
113 try {
114 inst = Activator.CreateInstance(attr.HasherType, attr.Endian);
115 } catch {
116 try {
117 inst = Activator.CreateInstance(attr.HasherType);
118 } catch {
119 inst = null;
120 }
121 }
122
123 if ( inst is IHash hasher ) {
124 var h = hasher.ComputeLong(input, m_seed );
125 _hash = (long)h.Value;
126 } else {
127 _hash = base.GetHashCode();
128 }
129 }
130
131 return _hash;
132 }