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
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

ProtoBuf tutorial: “AddressBook does not implement “github.com/gogo/protobuf/proto”.Message (ProtoMessage method has pointer receiver)”

I’m trying to follow along with this tutorial on ProtoBufs: https://developers.google.com/protocol-buffers/docs/gotutorial. I have the following project structure: . ├── addressbook │   ├── addressbook.pb.go │   └── addressbook.proto ├── go.mod ├── go.sum └── main.go where addressbook.proto is syntax = “proto3”; package addressbook; import “google/protobuf/timestamp.proto”; message Person { string name = 1; int32 id = 2; string email […]

Categories
Development

Decrypt AES in ECB mode

I’m trying to decrypt a simple frame : uint8_t chipertext[] = {0x72, 0x82, 0xC9, 0xAA, 0x1F, 0xE1, 0x84, 0x97, 0x06, 0x65, 0x58, 0x5D, 0x06, 0x7B, 0xD4, 0xB4}; which was encrypted by the following key : uint8_t aes_key[] = {0x0A, 0x1A, 0x2A, 0x3A, 0x0B, 0x1B, 0x2B, 0x3B, 0x0C, 0x1C, 0x2C, 0x3C, 0x0D, 0x1D, 0x2D, 0x3D}; I […]

Categories
Development

How to send uint8_t array from C to GO

I want to send uint8_t array from C to GO, but whene i send my array like pointer, i don’t know how i can read it and save it in GO like byte[] array : package main /* #include <stdint.h> uint8_t Plaintext[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, […]

Categories
Development

Weird behavior when writing to 0xB8000 / corrupted pointer

I’m currently developing an OS kernel from scratch. I want to use a function to write characters on the screen , using the 0xB8000 memory location. the problem is the following : I use : void video_write(const unsigned char *string , char color ){ unsigned char *p = (unsigned char*) string ; char *c = […]

Categories
Development

Print out items from a list in R with different nested levels

I have a list in R with the structure as in the dput output. Update: structure(list(name = c(“\\text{Students are able to identify relationship between l (or ml) and cm³\n}”, “\\text{Students are able to write down the notation and representations of fractions \n}”, “\\text{Scientific enquiry}”, “\\text{Polska w okresie rozbicia dzielnicowego.}” ), index = c(26L, 39L, 0L, […]

Categories
Development

Java Swing : Extended ASCII characters not showing

I’m trying to display ASCII characters in my JTextPanel, but it doesn’t work for a few extended characters like ASCII 217, ASCII 180, and the up arrow that I didn’t find in the ASCII table. I read a file from the file system with ASCII characters, and let’s say for the moment that my problem […]

Categories
Development

How SQL Server store/transfer decimal stream

I’m working on MS-TDS protocol, what I’m trying todo is to read/write TDS stream, and get/set a System.Data.DataTable from/to it. I got all C# types working already, except decimal varchar(max) varbinary(max) columns in C#, I got following results for 12345678912345678912.3456789m and 1234567891234567891.23456789m var bits = decimal.GetBits(12345678912345678912.3456789m) using (var ms = new System.IO.MemoryStream()) { foreach (var […]