Skip to content

Commit

Permalink
Cleaning up ant_network_keys and adding some examples in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
RCayre committed Mar 30, 2023
1 parent 0bc0058 commit b783ddd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
31 changes: 30 additions & 1 deletion ant_network_keys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,44 @@ This folder contains the specification describing the validation of ANT network

In *spec.md*, you can find the specification written after a reverse engineering process of the ANT NRF52 SoftDevice.

## Testing the implementation

To use the implementation, use :

`
$ make
`

Then you can run the binary and provide a key to check the validity and generate the corresponding ANT preamble:
Then you can run the binary and provide a key as an hexadecimal stream to check the validity and generate the corresponding ANT preamble:

`
$ cd build
$ ./key
`

For example, you can provide the ANT+ Network Key (45C372BDFB21A5B9), which should be valid and generate the preamble 0xc5a6:

`
$ ./key
Key: 45C372BDFB21A5B9

The provided key is correct, and the corresponding preamble is: 0xc5a6
`

You can also try the ANT-FS Network Key (C1635EF5B923A4A8), which should also be valid and generate the preamble 0xa33b:

`
$ ./key
Key: 45C372BDFB21A5B9

The provided key is correct, and the corresponding preamble is: 0xc5a6
`

Finally, if you try an incorrect key like 1122334455667788, it should indicate that the key is invalid and don't generate any preamble.

`
$ ./key
Key: 1122334455667788

Error: invalid key
`
Binary file removed ant_network_keys/build/key
Binary file not shown.
2 changes: 0 additions & 2 deletions ant_network_keys/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ the most significant byte is formed by combining several expressions using a or
- the second expression takes the 3rd and the 4th bytes of the key, xor them together, and applies a mask of value 0xc0 using an and bitwise operator
- the third expression takes the 3rd byte of the key and applies a mask of value 0x13 using an and bitwise operator
- the fourth expression takes the 3rd, the 4th, the 5th and the 6th bytes of the key, xor them together, and applies a mask of value 0x24 using an and bitwise operator
:w
-

0 comments on commit b783ddd

Please sign in to comment.