Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
TOTP2FA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ed8g20
TOTP2FA
Commits
2d5425a9
Commit
2d5425a9
authored
2 years ago
by
ed8g20
Browse files
Options
Downloads
Patches
Plain Diff
Update 3 files
- /synchronised_time.py - /main.py - /base32.py
parent
ae34ef8e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
base32.py
+3
-24
3 additions, 24 deletions
base32.py
main.py
+1
-2
1 addition, 2 deletions
main.py
synchronised_time.py
+1
-4
1 addition, 4 deletions
synchronised_time.py
with
5 additions
and
30 deletions
base32.py
+
3
−
24
View file @
2d5425a9
def
base32_decode
(
message
):
"""
Decodes the supplied encoded Base32 message into a byte string
...
...
@@ -14,28 +15,6 @@ def base32_decode(message):
decoded
=
[]
for
chunk
in
chunks
:
bits
=
0
bitbuff
=
0
for
c
in
chunk
:
if
'
A
'
<=
c
<=
'
Z
'
:
n
=
ord
(
c
)
-
ord
(
'
A
'
)
elif
'
2
'
<=
c
<=
'
7
'
:
n
=
ord
(
c
)
-
ord
(
'
2
'
)
+
26
elif
c
==
'
=
'
:
continue
else
:
raise
ValueError
(
"
Not Base32
"
)
bits
+=
5
bitbuff
<<=
5
bitbuff
|=
n
if
bits
>=
8
:
bits
-=
8
byte
=
bitbuff
>>
bits
bitbuff
&=
~
(
0xFF
<<
bits
)
decoded
.
append
(
byte
)
#TODO: impliment method
return
bytes
(
decoded
)
This diff is collapsed.
Click to expand it.
main.py
+
1
−
2
View file @
2d5425a9
...
...
@@ -29,8 +29,7 @@ selected_idx = 0
synchronised_time
=
create_synchronised_time
(
display
,
button_a
,
button_b
,
button_x
,
button_y
)
while
True
:
if
button_a
.
read
()
:
selected_idx
=
(
selected_idx
+
1
)
%
len
(
codes
)
#TODO: change selected when user presses a button
code
=
codes
[
selected_idx
]
...
...
This diff is collapsed.
Click to expand it.
synchronised_time.py
+
1
−
4
View file @
2d5425a9
...
...
@@ -40,9 +40,6 @@ def create_synchronised_time(display, button_a, button_b, button_x, button_y):
display
.
update
()
time
.
sleep
(
0.3
)
delta
=
time
.
mktime
(
datetime
+
[
0
,
0
])
-
int
(
time
.
time
())
def
synchronised_time
():
return
int
(
time
.
time
())
+
delta
# TODO: Create a function that returns the epoch time when then function is run, called synchronised_time
return
synchronised_time
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