🗒️
notes
  • Journal
  • URLs
  • Java Card
    • SCP02
    • Rapid Notes
    • _FIXVALS_
    • Mifare
    • Chain Of Trust
  • Encoding
    • CBEFF
    • Bytes
  • Snippets
    • JNI_OnLoad
  • float to byte[]
  • Protobuf
  • C/C++
    • Containers
    • Basics
    • JNI
    • gcov
    • Castings
  • chess
    • Untitled
  • Compression
    • Untitled
  • Snippets
    • Untitled
  • Build Systems
    • Maven
    • Windows
  • Gradle
  • CMake
  • Java
    • Untitled
    • Certificates
  • Android
    • Mifare
  • Python
    • ctypes
  • WebSub
    • References
  • Spring Boot
    • Form-based Authentication
    • Basic Access Authentication
    • JWT Authentication
  • QR Code
    • Denso QR Code
  • Philosophical Inquiry
    • First
  • XML
    • xmlstarlet
Powered by GitBook
On this page

Was this helpful?

  1. C/C++

Basics

Dynamically create an array of array:

void doforloop(unsigned char **buf,int x, int y)
{
    unsigned char *key = new unsigned char[y];
    for (int i = 0; i < 3; i++) {
        std::memcpy(key, buf[i], 64);
    }
    delete key;
}

int main() {
    unsigned char **ptr = new unsigned char *[3];

    for (int i = 0; i < 3; i++) {
        ptr[i] = new unsigned char[64];     
        randombytes_buf(ptr[i], 64);
        ptr[i][0] = (unsigned char)0xFA;
        ptr[i][1] = (unsigned char)0xCE;
        ptr[i][62] = (unsigned char)0xBA;
        ptr[i][63] = (unsigned char)0xBE;
    }
    
    doforloop(ptr, 3, 64);
}
PreviousContainersNextJNI

Last updated 4 years ago

Was this helpful?