Skip to content

Instantly share code, notes, and snippets.

View torinnguyen's full-sized avatar

Torin Nguyen torinnguyen

View GitHub Profile
@torinnguyen
torinnguyen / Broadlink MP1 control with Python
Last active January 20, 2018 23:10
Use Python script to control all/any buttons on Broadlink MP1 smart socket. This data was captured with Wireshark on an iPhone connected to USB port (rvi0 interface)
// http://stackoverflow.com/questions/17535918/aes-gets-different-results-in-ios-and-java
- (NSData *)AES256EncryptWithKey:(NSString *)key {
// 'key' should be 32 bytes for AES256, will be null-padded otherwise
char keyPtr[kCCKeySizeAES256+1]; // room for terminator (unused)
bzero(keyPtr, sizeof(keyPtr)); // fill with zeroes (for padding)
// fetch key data
[key getCString:keyPtr maxLength:sizeof(keyPtr) encoding:NSUTF8StringEncoding];