Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OTRv4
otrv4_reference_design
Commits
4fb4d9d1
Commit
4fb4d9d1
authored
Nov 14, 2016
by
Fan Jiang
Browse files
can use rid to identify alice and bob
parent
72a96dcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
double_ratchet.go
View file @
4fb4d9d1
...
...
@@ -42,13 +42,7 @@ func (e *Entity) send() Msg {
e
.
r_flag
=
false
}
toSend
:=
Msg
{
e
.
name
,
e
.
rid
,
e
.
j
,
e
.
our_dh_pub
}
if
e
.
name
==
"Alice"
{
cj
=
e
.
retriveChainkey
(
e
.
rid
,
e
.
j
,
true
)
}
else
{
cj
=
e
.
retriveChainkey
(
e
.
rid
,
e
.
j
,
false
)
}
cj
=
e
.
retriveChainkey
(
e
.
rid
,
e
.
j
)
e
.
j
+=
1
fmt
.
Printf
(
"%s
\t
sending: %v
\n
"
,
e
.
name
,
toSend
)
fmt
.
Printf
(
"%s
\t
our key: %x
\n
"
,
e
.
name
,
cj
)
...
...
@@ -67,17 +61,14 @@ func (e *Entity) receive(m Msg) {
e
.
derive
(
secret
)
e
.
k
=
0
}
if
e
.
name
==
"Bob"
{
ck
=
e
.
retriveChainkey
(
m
.
rid
,
m
.
mid
,
true
)
}
else
{
ck
=
e
.
retriveChainkey
(
m
.
rid
,
m
.
mid
,
false
)
}
ck
=
e
.
retriveChainkey
(
m
.
rid
,
m
.
mid
)
fmt
.
Printf
(
"%s
\t
their key: %x
\n
"
,
e
.
name
,
ck
)
}
func
(
e
*
Entity
)
retriveChainkey
(
rid
,
mid
int
,
alice
bool
)
key
{
func
(
e
*
Entity
)
retriveChainkey
(
rid
,
mid
int
)
key
{
var
ck
key
buf
:=
make
([]
byte
,
64
)
alice
:=
rid
%
2
==
1
if
alice
{
ck
=
e
.
Ca
[
rid
]
}
else
{
...
...
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