Categories
Mastering Development

Plain text to C array test vectors

I am implementing AES as described by FIPS_197 and I wish to implement the test cases described in Appendix C (C1 – C3). I have copied the test cases into a text file FIPS_197_tests.txt That looks like this: # Test cases from FIPS_192 Appendix C # Plaintext # Key # Output # # C.1 AES-128 […]

Categories
Mastering Development

How do I unmarshal a PyCodeObject using PyO3?

I am reading .pyc files, and need to be able to unmarshal code objects. When I try to downcast the unmarshalled PyAny to PyCodeObject, I get the following error message: error[E0277]: the trait bound `pyo3::ffi::code::PyCodeObject: pyo3::type_object::PyTypeInfo` is not satisfied –> src/lib.rs:179:47 | 179 | let code = *(loads(py, &code_buffer)?.downcast::<PyCodeObject>()?); | ^^^^^^^^ the trait `pyo3::type_object::PyTypeInfo` is […]

Categories
Mastering Development

How to send byte array with processing

I’m new to processing. I’ve made some GUI in Processing and I need to send some bytes to another MCU via Serial port to control LEDs. I need to send this code A0 0C 01 A2. byte on[]={0xA0, 0x0C, 0x01, 0xA2}; port.write(on); //This won’t compile How I can do that?

Categories
Mastering Development

AES256 OFB mode getting keystream in C/C++

I am working on a project which involve AES256 OFB mode. Also, I am using the library from AES library from Brian Gladman. My question is: how can I generate keystreams? My understanding is that i have a initial vector to start with. We would encrypt the IV to get a keystream, then the keystream […]

Categories
Development

python proxy script have some problems

i was tried to use asyncio and threading libraries in different scripts. but threading will cause this error in high connections: filedescriptor out of range in select() my source that cause this error: try: reader, _, _ = select.select([socket_src, socket_dst], [], [], 1) except select.error as err: error(“Select failed”, err) i tried to increase fd […]

Categories
Development

Force PC/SC driver on ACR1252U NFC reader and enter card emulation mode using python

Objective: let ACR1252U NFC reader enter card emulation mode using python on Mac I have trouble with using the ACS ACR1252U card reader on macOS Catalina 10.15.3 using the PC/SC driver. I installed the driver from the ACS website. My following python code works and return the correct enter card emulation mode response on windows […]

Categories
Development

Most efficent way to calculate CRC64 with reflected input

I need to calculate a CRC-64 using this setup into this wonderful website: http://www.sunshine2k.de/coding/javascript/crc/crc_js.html As you can see I require “input reflected” and that means that I need to reverse the bit order of any byte (a bit annoying). For the moment, I implemented this with a lookup table (for example 0x55 -> 0xAA), but […]

Categories
Development

Cannot figure out how to send data to hat switch from stm32f103c8 to PC via USB

I have recently restarted to play around with micro controllers and finally got kinda stuck. So what I am building is a custom game pad. I can simulate data correctly for buttons but nothing works when I bring in the hat switch. I assume I am sending wrong data packet but cannot figure out the […]

Categories
Development

How to output in file uchar?

I have massive of unsigned char[128] = {0xFF, 0xBE,…0x99};. And need to output it to .txt or .bin file. But all fuctions that I tried could work only with const char*. So, what should I use to output uchar[]? I tried fstream and QFile. // 1 2 3 4 5 6 7 8 9 10 […]

Categories
Development

phpseclib not verifying a signature generated in window.subtlecrypto

So yeah my boss wants to put encryption into his system and he wants messages signed in js and verified in php. currently, I’m using mozilla’s subtlecrypto api to generate RSA-PSS keys and sign and phpseclib to verify. The thing is, it doesn’t. Using the js keys, phpseclib can sign and verify just fine, but […]