This commit is contained in:
2026-08-31 22:43:51 -04:00
commit c87308caca
521 changed files with 141326 additions and 0 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
+71
View File
@@ -0,0 +1,71 @@
SENT: (28, 2, 15, 27, 1, 25, 1)
====================================
RECEIVED: (62, 98, 1, 1, 79, 122, 122, 105, 101, 44, 53, 53, 48, 109, 109, 109)
FLAG: 1
SENT: (33, 2, 15, 27, 1, 25, 1)
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 2, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 9, 218)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
====================================
RECEIVED: (255, 19, 2, 31, 79, 122, 122, 105, 101, 32, 32, 32, 32, 32, 44, 53, 53, 48, 109, 109, 32, 32, 32, 32, 3, 1, 3, 15, 27, 1, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 32, 232)
FLAG: 31
@@ -0,0 +1,43 @@
import os
import pickle
import struct
with open('packet_dump','rb') as ff:
packet = pickle.load(ff)
def get_3byte_hash(packet):
hashed = 0;
for x in packet:
hashed = (hashed*31 + x) % 0xFFFFFF
return hashed
def get_bytes(value):
return list(value.to_bytes(4, byteorder='little'))
to_id = packet[0]
from_id = packet[1]
msg_format = packet[2]
msg_type = packet[3]
name = packet[4:14]
wheel_diameter = packet[14:24]
battery_reading = struct.unpack('<' + 'H', packet[24:26])[0]
time_reading = struct.unpack('<'+'B'*5, packet[26:31])
wheel_counts = struct.unpack('<'+'H'*15, packet[31:61])
b1, b2, b3 = struct.unpack('<BBB',packet[61:64])
hash_from_msg = b1 | b2<<8 | b3<<16
hash_calculated = get_hash(packet[4:61])
if hash_calculated == hash_from_msg:
print('Hashes match!')
else:
print("Hashes do not match")
Binary file not shown.
+111
View File
@@ -0,0 +1,111 @@
# SPDX-FileCopyrightText: 2018 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Example for using the RFM69HCW Radio with Raspberry Pi.
Learn Guide: https://learn.adafruit.com/lora-and-lorawan-for-raspberry-pi
Author: Brent Rubell for Adafruit Industries
"""
from datetime import datetime
# Import Python System Libraries
import time
from datetime import datetime
# Import Blinka Libraries
import busio
from digitalio import DigitalInOut, Direction, Pull
import board
# Import the SSD1306 module.
# import adafruit_ssd1306
# Import the RFM69 radio module.
import adafruit_rfm69
# import numpy as np
import ctypes
import struct
import pickle
import os
# # Button A
# btnA = DigitalInOut(board.D5)
# btnA.direction = Direction.INPUT
# btnA.pull = Pull.UP
# # Button B
# btnB = DigitalInOut(board.D6)
# btnB.direction = Direction.INPUT
# btnB.pull = Pull.UP
# # Button C
# btnC = DigitalInOut(board.D12)
# btnC.direction = Direction.INPUT
# btnC.pull = Pull.UP
# # Create the I2C interface.
# i2c = busio.I2C(board.SCL, board.SDA)
# # 128x32 OLED Display
# reset_pin = DigitalInOut(board.D4)
# display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, reset=reset_pin)
# # Clear the display.
# display.fill(0)
# display.show()
# width = display.width
# height = display.height
# Configure Packet Radio
CS = DigitalInOut(board.CE1)
RESET = DigitalInOut(board.D25)
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
rfm69 = adafruit_rfm69.RFM69(spi, CS, RESET, 434.0, high_power=True)
prev_packet = None
# Optionally set an encryption key (16 byte AES key). MUST match both
# on the transmitter and receiver (or be set to None to disable/the default).
# rfm69.encryption_key = b'\x01\x02\x03\x04\x05\x06\x07\x08\x01\x02\x03\x04\x05\x06\x07\x08'
rfm69.encryption_key = None;
rfm69.tx_power=20;
def unpack_uint8(m):
return struct.unpack('B'*len(m), m)
def send_now():
rfm69.idle()
n = datetime.now()
add_this = [n.second,n.minute,n.hour,n.day,n.month,n.year-2000,n.isoweekday()]
b_ar = bytearray();
for x in add_this:
b_ar += ctypes.c_uint8(x)
msg_send = b_ar;
for i in range(3):
rfm69.send(msg_send, flags=2, keep_listening = True); # Date time return request
time.sleep(0.05);
print('SENT:\t\t',unpack_uint8(msg_send))
# print("Sent!", add_this);
send_now();
while True:
# send_now();
packet = None
packet = rfm69.receive(with_header = True)
if packet is not None:
# = packet
print('====================================')
print('RECEIVED:\t',unpack_uint8(packet))
packet_flag = packet[3]
print('FLAG:\t',packet_flag)
if packet_flag == 1:
send_now();
if packet_flag == 31:
if not os.path.exists('packet_dump'):
pickle.dump(packet, open('packet_dump','wb'));
# print(packet_flag, prev_packet);
# packet_text = str(prev_packet[4:], "utf-8")
# print(packet_text)
# time.sleep(0.01)
+99
View File
@@ -0,0 +1,99 @@
# SPDX-FileCopyrightText: 2018 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
Example for using the RFM69HCW Radio with Raspberry Pi.
Learn Guide: https://learn.adafruit.com/lora-and-lorawan-for-raspberry-pi
Author: Brent Rubell for Adafruit Industries
"""
# Import Python System Libraries
import time
# Import Blinka Libraries
import busio
from digitalio import DigitalInOut, Direction, Pull
import board
# Import the SSD1306 module.
import adafruit_ssd1306
# Import the RFM69 radio module.
import adafruit_rfm69
# Button A
btnA = DigitalInOut(board.D5)
btnA.direction = Direction.INPUT
btnA.pull = Pull.UP
# Button B
btnB = DigitalInOut(board.D6)
btnB.direction = Direction.INPUT
btnB.pull = Pull.UP
# Button C
btnC = DigitalInOut(board.D12)
btnC.direction = Direction.INPUT
btnC.pull = Pull.UP
# Create the I2C interface.
i2c = busio.I2C(board.SCL, board.SDA)
# 128x32 OLED Display
reset_pin = DigitalInOut(board.D4)
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, reset=reset_pin)
# Clear the display.
display.fill(0)
display.show()
width = display.width
height = display.height
# Configure Packet Radio
CS = DigitalInOut(board.CE1)
RESET = DigitalInOut(board.D25)
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
rfm69 = adafruit_rfm69.RFM69(spi, CS, RESET, 915.0)
prev_packet = None
# Optionally set an encryption key (16 byte AES key). MUST match both
# on the transmitter and receiver (or be set to None to disable/the default).
rfm69.encryption_key = b'\x01\x02\x03\x04\x05\x06\x07\x08\x01\x02\x03\x04\x05\x06\x07\x08'
while True:
packet = None
# draw a box to clear the image
display.fill(0)
display.text('RasPi Radio', 35, 0, 1)
# check for packet rx
packet = rfm69.receive()
if packet is None:
display.show()
display.text('- Waiting for PKT -', 15, 20, 1)
else:
# Display the packet text and rssi
display.fill(0)
prev_packet = packet
packet_text = str(prev_packet, "utf-8")
display.text('RX: ', 0, 0, 1)
display.text(packet_text, 25, 0, 1)
time.sleep(1)
if not btnA.value:
# Send Button A
display.fill(0)
button_a_data = bytes("Button A!\r\n","utf-8")
rfm69.send(button_a_data)
display.text('Sent Button A!', 25, 15, 1)
elif not btnB.value:
# Send Button B
display.fill(0)
button_b_data = bytes("Button B!\r\n","utf-8")
rfm69.send(button_b_data)
display.text('Sent Button B!', 25, 15, 1)
elif not btnC.value:
# Send Button C
display.fill(0)
button_c_data = bytes("Button C!\r\n","utf-8")
rfm69.send(button_c_data)
display.text('Sent Button C!', 25, 15, 1)
display.show()
time.sleep(0.1)
+20
View File
@@ -0,0 +1,20 @@
#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>
uint32_t hash_me(const char* str) {
uint32_t hash = 0; // Start with a 32-bit hash (we'll constrain to 24 bits)
while (*str) {
hash = (hash * 31 + (uint8_t)(*str)) % 0xFFFFFF;
str++;
}
return hash;
}
void main()
{
uint32_t hash_result= hash_me("Hello World");
printf("%"PRIu32"\n", hash_result);
}