Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
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
hive
beem
Commits
e872df16
Commit
e872df16
authored
6 years ago
by
Holger
Browse files
Options
Downloads
Patches
Plain Diff
Fix missing int.from_byte for py2.7
parent
be769901
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beemgraphenebase/account.py
+6
-2
6 additions, 2 deletions
beemgraphenebase/account.py
with
6 additions
and
2 deletions
beemgraphenebase/account.py
+
6
−
2
View file @
e872df16
...
...
@@ -11,13 +11,14 @@ import hashlib
import
sys
import
re
import
os
import
codecs
import
ecdsa
import
ctypes
from
binascii
import
hexlify
,
unhexlify
from
.base58
import
ripemd160
,
Base58
from
.dictionary
import
words
as
BrainKeyDictionary
from
.py23
import
py23_bytes
from
.py23
import
py23_bytes
,
PY2
class
PasswordKey
(
object
):
...
...
@@ -135,7 +136,10 @@ class BrainKey(object):
urand
=
os
.
urandom
(
2
)
if
isinstance
(
urand
,
str
):
urand
=
py23_bytes
(
urand
,
'
ascii
'
)
num
=
int
.
from_bytes
(
urand
,
byteorder
=
"
little
"
)
if
PY2
:
num
=
int
(
codecs
.
encode
(
urand
[::
-
1
],
'
hex
'
),
16
)
else
:
num
=
int
.
from_bytes
(
urand
,
byteorder
=
"
little
"
)
rndMult
=
num
/
2
**
16
# returns float between 0..1 (inclusive)
wIdx
=
round
(
len
(
dict_lines
)
*
rndMult
)
brainkey
[
j
]
=
dict_lines
[
wIdx
]
...
...
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