Skip to content

Commit

Permalink
Fixed long lines in std/digest/hmac.d
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Stouffer authored and JackStouffer committed May 11, 2016
1 parent a15dda6 commit 8c58418
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions std/digest/hmac.d
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ if (hashBlockSize % 8 == 0)
import std.string : representation;
auto hmac = HMAC!SHA1("My s3cR3T keY".representation);
hmac.put("Hello, world".representation);
static immutable expected = [130, 32, 235, 44, 208, 141, 150, 232, 211, 214, 162, 195, 188, 127, 52, 89, 100, 68, 90, 216];
static immutable expected = [
130, 32, 235, 44, 208, 141,
150, 232, 211, 214, 162, 195,
188, 127, 52, 89, 100, 68, 90, 216];
assert(hmac.finish() == expected);
}

Expand Down Expand Up @@ -133,7 +136,10 @@ if (hashBlockSize % 8 == 0)
hmac.put(data1.representation);
hmac.start(); // reset digest
hmac.put(data2.representation); // start over
static immutable expected = [122, 151, 232, 240, 249, 80, 19, 178, 186, 77, 110, 23, 208, 52, 11, 88, 34, 151, 192, 255];
static immutable expected = [
122, 151, 232, 240, 249, 80,
19, 178, 186, 77, 110, 23, 208,
52, 11, 88, 34, 151, 192, 255];
assert(hmac.finish() == expected);
}

Expand All @@ -160,7 +166,10 @@ if (hashBlockSize % 8 == 0)
auto hmac = HMAC!SHA1("My s3cR3T keY".representation);
hmac.put(data1.representation)
.put(data2.representation);
static immutable expected = [197, 57, 52, 3, 13, 194, 13, 36, 117, 228, 8, 11, 111, 51, 165, 3, 123, 31, 251, 113];
static immutable expected = [
197, 57, 52, 3, 13, 194, 13,
36, 117, 228, 8, 11, 111, 51,
165, 3, 123, 31, 251, 113];
assert(hmac.finish() == expected);
}

Expand Down Expand Up @@ -194,7 +203,10 @@ if (hashBlockSize % 8 == 0)
auto digest = hmac.put(data1.representation)
.put(data2.representation)
.finish();
static immutable expected = [197, 57, 52, 3, 13, 194, 13, 36, 117, 228, 8, 11, 111, 51, 165, 3, 123, 31, 251, 113];
static immutable expected = [
197, 57, 52, 3, 13, 194, 13,
36, 117, 228, 8, 11, 111, 51,
165, 3, 123, 31, 251, 113];
assert(digest == expected);
}
}
Expand Down Expand Up @@ -231,7 +243,10 @@ if (isDigest!H)
.put(data1.representation)
.put(data2.representation)
.finish();
static immutable expected = [197, 57, 52, 3, 13, 194, 13, 36, 117, 228, 8, 11, 111, 51, 165, 3, 123, 31, 251, 113];
static immutable expected = [
197, 57, 52, 3, 13, 194, 13, 36,
117, 228, 8, 11, 111, 51, 165,
3, 123, 31, 251, 113];
assert(digest == expected);
}

Expand Down Expand Up @@ -264,7 +279,10 @@ if (isDigest!H)
.map!(a => cast(ubyte)(a+1))
.hmac!SHA1("My s3cR3T keY".representation);
static assert(is(typeof(digest) == ubyte[20]));
static immutable expected = [163, 208, 118, 179, 216, 93, 17, 10, 84, 200, 87, 104, 244, 111, 136, 214, 167, 210, 58, 10];
static immutable expected = [
163, 208, 118, 179, 216, 93,
17, 10, 84, 200, 87, 104, 244,
111, 136, 214, 167, 210, 58, 10];
assert(digest == expected);
}
}
Expand Down Expand Up @@ -298,7 +316,8 @@ unittest

import std.string : representation;
auto key = "key".representation,
long_key = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789".representation,
long_key = ("012345678901234567890123456789012345678901"
~"234567890123456789012345678901234567890123456789").representation,
data1 = "The quick brown fox ".representation,
data2 = "jumps over the lazy dog".representation,
data = data1 ~ data2;
Expand Down

0 comments on commit 8c58418

Please sign in to comment.