Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
fb687a71
Commit
fb687a71
authored
5 years ago
by
muXxer
Browse files
Options
Downloads
Patches
Plain Diff
Fix: bct_curl state constant too big on 32-bit systems
parent
67b6a6e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/curl/batch_hasher.go
+1
-1
1 addition, 1 deletion
packages/curl/batch_hasher.go
packages/curl/bct_curl.go
+11
-4
11 additions, 4 deletions
packages/curl/bct_curl.go
with
12 additions
and
5 deletions
packages/curl/batch_hasher.go
+
1
−
1
View file @
fb687a71
...
...
@@ -43,7 +43,7 @@ func (this *BatchHasher) processHashes(tasks []batchworkerpool.Task) {
}
// calculate the hash
bctCurl
:=
NewBCTCurl
(
this
.
hashLength
,
this
.
rounds
)
bctCurl
:=
NewBCTCurl
(
this
.
hashLength
,
this
.
rounds
,
strconv
.
IntSize
)
bctCurl
.
Reset
()
bctCurl
.
Absorb
(
bcTrits
)
...
...
This diff is collapsed.
Click to expand it.
packages/curl/bct_curl.go
+
11
−
4
View file @
fb687a71
...
...
@@ -3,22 +3,29 @@ package curl
import
"github.com/iotaledger/goshimmer/packages/ternary"
const
(
HIGH_LONG_BITS
=
0xFFFFFFFFFFFFFFFF
NUMBER_OF_TRITS_IN_A_TRYTE
=
3
)
type
BCTCurl
struct
{
hashLength
int
numberOfRounds
int
highLongBits
uint
stateLength
int
state
ternary
.
BCTrits
cTransform
func
()
}
func
NewBCTCurl
(
hashLength
int
,
numberOfRounds
int
)
*
BCTCurl
{
func
NewBCTCurl
(
hashLength
int
,
numberOfRounds
int
,
batchSize
int
)
*
BCTCurl
{
var
highLongBits
uint
for
i
:=
0
;
i
<
batchSize
;
i
++
{
highLongBits
+=
1
<<
uint
(
i
)
}
this
:=
&
BCTCurl
{
hashLength
:
hashLength
,
numberOfRounds
:
numberOfRounds
,
highLongBits
:
highLongBits
,
stateLength
:
NUMBER_OF_TRITS_IN_A_TRYTE
*
hashLength
,
state
:
ternary
.
BCTrits
{
Lo
:
make
([]
uint
,
NUMBER_OF_TRITS_IN_A_TRYTE
*
hashLength
),
...
...
@@ -34,8 +41,8 @@ func NewBCTCurl(hashLength int, numberOfRounds int) *BCTCurl {
func
(
this
*
BCTCurl
)
Reset
()
{
for
i
:=
0
;
i
<
this
.
stateLength
;
i
++
{
this
.
state
.
Lo
[
i
]
=
HIGH_LONG_BITS
this
.
state
.
Hi
[
i
]
=
HIGH_LONG_BITS
this
.
state
.
Lo
[
i
]
=
this
.
highLongBits
this
.
state
.
Hi
[
i
]
=
this
.
highLongBits
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment