Skip to content

Commit eecf272

Browse files
authored
Remove MD5Hasher. (#2706)
1 parent 160eade commit eecf272

File tree

9 files changed

+1
-240
lines changed

9 files changed

+1
-240
lines changed

src/Microsoft.ML.FastTree/BinFile/IniFileParserInterface.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ public sealed class FeatureEvaluator
254254

255255
public int Id { get; }
256256

257-
public MD5Hash ContentMD5Hash => MD5Hasher.Hash(Content);
258-
259257
// Return the name of the input
260258
public unsafe string Name => _parserInterface.GetInputName(Id);
261259

src/Microsoft.ML.FastTree/Dataset/DenseIntArray.cs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ public Dense0BitIntArray(byte[] buffer, ref int position)
155155
{
156156
}
157157

158-
public override MD5Hash MD5Hash
159-
{
160-
get { return MD5Hasher.Hash(Length); }
161-
}
162-
163158
/// <summary>
164159
/// Returns the number of bytes written by the member ToByteArray()
165160
/// </summary>
@@ -271,11 +266,6 @@ private void Set(long offset, uint mask, int value)
271266
_data[major + 1] = (_data[major + 1] & ~major1Mask) | (uint)(val >> 32);
272267
}
273268

274-
public override MD5Hash MD5Hash
275-
{
276-
get { return MD5Hasher.Hash(_data); }
277-
}
278-
279269
/// <summary>
280270
/// Returns the number of bytes written by the member ToByteArray()
281271
/// </summary>
@@ -414,8 +404,6 @@ public Dense8BitIntArray(int len, IEnumerable<int> values)
414404
_data = values.Select(i => (byte)i).ToArray(len);
415405
}
416406

417-
public override MD5Hash MD5Hash => MD5Hasher.Hash(_data);
418-
419407
/// <summary>
420408
/// Returns the number of bytes written by the member ToByteArray()
421409
/// </summary>
@@ -482,11 +470,6 @@ internal sealed class Dense4BitIntArray : DenseIntArray
482470

483471
public override IntArrayBits BitsPerItem { get { return IntArrayBits.Bits4; } }
484472

485-
public override MD5Hash MD5Hash
486-
{
487-
get { return MD5Hasher.Hash(_data); }
488-
}
489-
490473
public Dense4BitIntArray(int len)
491474
: base(len)
492475
{
@@ -622,11 +605,6 @@ public Dense16BitIntArray(byte[] buffer, ref int position)
622605
_data = buffer.ToUShortArray(ref position);
623606
}
624607

625-
public override MD5Hash MD5Hash
626-
{
627-
get { return MD5Hasher.Hash(_data); }
628-
}
629-
630608
public override unsafe void Callback(Action<IntPtr> callback)
631609
{
632610
fixed (ushort* pData = _data)
@@ -719,11 +697,6 @@ public override unsafe void Callback(Action<IntPtr> callback)
719697
}
720698
}
721699

722-
public override MD5Hash MD5Hash
723-
{
724-
get { return MD5Hasher.Hash(_data); }
725-
}
726-
727700
/// <summary>
728701
/// Returns the number of bytes written by the member ToByteArray()
729702
/// </summary>

src/Microsoft.ML.FastTree/Dataset/Feature.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public enum FeatureType
3333
#endif
3434

3535
public bool IsTrivialFeature { get; private set; }
36-
public MD5Hash MD5Hash { get; private set; }
36+
3737
public IntArrayType BinsType { get; private set; }
3838
#if !NO_STORE
3939
public FileObjectStore<IntArrayFormatter> BinsCache { get; set; }
@@ -45,12 +45,6 @@ protected Feature(IntArray bins)
4545
BinsCache = FileObjectStore<IntArrayFormatter>.GetDefaultInstance();
4646
#endif
4747
IsTrivialFeature = bins.BitsPerItem == IntArrayBits.Bits0;
48-
49-
if (!IsTrivialFeature && bins.Length > 0)
50-
{
51-
MD5Hash = bins.MD5Hash;
52-
}
53-
5448
BinsType = bins.Type;
5549
}
5650

src/Microsoft.ML.FastTree/Dataset/IntArray.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ public virtual void ToByteArray(byte[] buffer, ref int position)
5555

5656
public abstract IntArrayType Type { get; }
5757

58-
public abstract MD5Hash MD5Hash { get; }
59-
6058
/// <summary>
6159
/// Number of bytes needed to store this number of values
6260
/// </summary>

src/Microsoft.ML.FastTree/Dataset/RepeatIntArray.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ public override int SizeInBytes()
105105
return _values.SizeInBytes() + _deltas.SizeInBytes() + sizeof(int) + base.SizeInBytes();
106106
}
107107

108-
public override MD5Hash MD5Hash
109-
{
110-
get { return MD5Hasher.Hash(_deltas) ^ _values.MD5Hash; }
111-
}
112-
113108
public override int Length { get { return _length; } }
114109

115110
public override IntArray Clone(IntArrayBits bitsPerItem, IntArrayType type)

src/Microsoft.ML.FastTree/Dataset/SegmentIntArray.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ public override IntArrayBits BitsPerItem
3434
get { return _bpi; }
3535
}
3636

37-
public override MD5Hash MD5Hash
38-
{
39-
get { return MD5Hasher.Hash(_data) ^ MD5Hasher.Hash(_segLength) ^ MD5Hasher.Hash(_segType); }
40-
}
41-
4237
public override IntArrayType Type
4338
{
4439
get { return IntArrayType.Segmented; }

src/Microsoft.ML.FastTree/Dataset/SparseIntArray.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,6 @@ public override IntArrayBits BitsPerItem
251251

252252
public override IntArrayType Type { get { return IntArrayType.Sparse; } }
253253

254-
public override MD5Hash MD5Hash
255-
{
256-
get { return MD5Hasher.Hash(_deltas) ^ _values.MD5Hash; }
257-
}
258-
259254
public override IntArray Clone(IntArrayBits bitsPerItem, IntArrayType type)
260255
{
261256
if (type == IntArrayType.Sparse || type == IntArrayType.Current)

src/Microsoft.ML.FastTree/Utils/MD5Hasher.cs

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/Microsoft.ML.FastTree/Utils/ToByteArrayExtensions.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,6 @@ public static ulong ToULong(this byte[] buffer, ref int position)
194194
return a;
195195
}
196196

197-
// RowId
198-
199-
public static MD5Hash ToRowId(this byte[] buffer, ref int position)
200-
{
201-
MD5Hash a = new MD5Hash
202-
{
203-
Prefix = buffer.ToULong(ref position),
204-
Suffix = buffer.ToULong(ref position)
205-
};
206-
return a;
207-
}
208-
209197
// float
210198

211199
public static int SizeInBytes(this float a)
@@ -550,33 +538,6 @@ public static unsafe ulong[] ToULongArray(this byte[] buffer, ref int position)
550538
return a;
551539
}
552540

553-
// RowId[]
554-
555-
public static int SizeInBytes(this MD5Hash[] array)
556-
{
557-
return sizeof(int) + Utils.Size(array) * MD5Hash.SizeInBytes();
558-
}
559-
560-
public static void ToByteArray(this MD5Hash[] a, byte[] buffer, ref int position)
561-
{
562-
a.Length.ToByteArray(buffer, ref position);
563-
for (int i = 0; i < a.Length; ++i)
564-
{
565-
a[i].ToByteArray(buffer, ref position);
566-
}
567-
}
568-
569-
public static unsafe MD5Hash[] ToRowIdArray(this byte[] buffer, ref int position)
570-
{
571-
int length = buffer.ToInt(ref position);
572-
MD5Hash[] a = new MD5Hash[length];
573-
for (int i = 0; i < length; ++i)
574-
{
575-
a[i] = buffer.ToRowId(ref position);
576-
}
577-
return a;
578-
}
579-
580541
// float[]
581542

582543
public static int SizeInBytes(this float[] array)

0 commit comments

Comments
 (0)