Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
e01459f5
Commit
e01459f5
authored
Dec 29, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply symmetric changes to sha1 and sha256 as to md4 and md5.
R=agl, agl1 CC=golang-dev
https://golang.org/cl/183083
parent
5042a4e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
24 deletions
+16
-24
sha1.go
src/pkg/crypto/sha1/sha1.go
+8
-12
sha256.go
src/pkg/crypto/sha256/sha256.go
+8
-12
No files found.
src/pkg/crypto/sha1/sha1.go
View file @
e01459f5
...
...
@@ -70,8 +70,8 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) {
n
:=
_Block
(
d
,
p
)
p
=
p
[
n
:
]
if
len
(
p
)
>
0
{
for
i
:=
0
;
i
<
len
(
p
);
i
++
{
d
.
x
[
i
]
=
p
[
i
]
for
i
,
x
:=
range
p
{
d
.
x
[
i
]
=
x
}
d
.
nx
=
len
(
p
)
}
...
...
@@ -102,16 +102,12 @@ func (d *digest) Sum() []byte {
p
:=
make
([]
byte
,
20
)
j
:=
0
for
i
:=
0
;
i
<
5
;
i
++
{
s
:=
d
.
h
[
i
]
p
[
j
]
=
byte
(
s
>>
24
)
j
++
p
[
j
]
=
byte
(
s
>>
16
)
j
++
p
[
j
]
=
byte
(
s
>>
8
)
j
++
p
[
j
]
=
byte
(
s
)
j
++
for
_
,
s
:=
range
d
.
h
{
p
[
j
+
0
]
=
byte
(
s
>>
24
)
p
[
j
+
1
]
=
byte
(
s
>>
16
)
p
[
j
+
2
]
=
byte
(
s
>>
8
)
p
[
j
+
3
]
=
byte
(
s
>>
0
)
j
+=
4
}
return
p
}
src/pkg/crypto/sha256/sha256.go
View file @
e01459f5
...
...
@@ -76,8 +76,8 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) {
n
:=
_Block
(
d
,
p
)
p
=
p
[
n
:
]
if
len
(
p
)
>
0
{
for
i
:=
0
;
i
<
len
(
p
);
i
++
{
d
.
x
[
i
]
=
p
[
i
]
for
i
,
x
:=
range
p
{
d
.
x
[
i
]
=
x
}
d
.
nx
=
len
(
p
)
}
...
...
@@ -108,16 +108,12 @@ func (d *digest) Sum() []byte {
p
:=
make
([]
byte
,
32
)
j
:=
0
for
i
:=
0
;
i
<
8
;
i
++
{
s
:=
d
.
h
[
i
]
p
[
j
]
=
byte
(
s
>>
24
)
j
++
p
[
j
]
=
byte
(
s
>>
16
)
j
++
p
[
j
]
=
byte
(
s
>>
8
)
j
++
p
[
j
]
=
byte
(
s
)
j
++
for
_
,
s
:=
range
d
.
h
{
p
[
j
+
0
]
=
byte
(
s
>>
24
)
p
[
j
+
1
]
=
byte
(
s
>>
16
)
p
[
j
+
2
]
=
byte
(
s
>>
8
)
p
[
j
+
3
]
=
byte
(
s
>>
0
)
j
+=
4
}
return
p
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment