Skip to content

Instantly share code, notes, and snippets.

View devendranaga's full-sized avatar
🍈

Dev devendranaga

🍈
  • Bangalore
View GitHub Profile
@devendranaga
devendranaga / list.c
Created March 12, 2022 16:11
o(1) based linked list implementation
#include <stdio.h>
#include <stdlib.h>
struct list {
void *data;
struct list *next;
};
static struct list *head, *last;
@devendranaga
devendranaga / poly1305-aes.c
Created March 6, 2022 16:48
poly1305-aes authentication
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/params.h>
@devendranaga
devendranaga / safe_queue.cc
Created November 4, 2021 12:30
safe_queue
/**
* @brief - a demo example of Safe Queue
*
* @copyright - 2021-present All rights reserved
*
* @author - Devendra Naga (devendra.aaru@outlook.com)
*
* @license - proprietary license, ask author for more information
*/
#include "safe_queue.h"
@devendranaga
devendranaga / safe_queue.h
Created November 4, 2021 12:30
safe_queue
/**
* @brief - implement Safe Queue technique for passing messages between various threads / classes
*
* @copyright - 2021-present All rights reserved
*
* @author - Devendra Naga (devendra.aaru@outlook.com)
*
* @license - proprietary license, ask author for more information
*/
#ifndef __SAFE_QUEUE_H__
project(needham_schroeder_protocol)
cmake_minimum_required(VERSION 3.8)
set(SRC
./ns.cc)
include_directories(./)
set(CMAKE_CXX_FLAGS "-Wall -g -ggdb")
#ifndef __NS_H__
#define __NS_H__
#include <iostream>
#include <string.h>
#include <string>
#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/rsa.h>
#include <ns.h>
static int generate_key(int key_size, const std::string pkey, const std::string ppkey)
{
RSA *rsa = nullptr;
BIGNUM *b;
FILE *fp;
int ret;
rsa = RSA_new();
@devendranaga
devendranaga / decorator.cc
Created January 1, 2021 07:16
decorator c++ design pattern
#include <iostream>
#include <string>
#include <memory>
#include <string.h>
class AddOn {
public:
explicit AddOn(std::string description) { description_ = description; }
~AddOn() = default;
#include <iostream>
#include <memory>
#include <queue>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
template <class T>
class Message_Queue {
/**
*
* HMAC tutorial
*
* Written by Devendra Naga (devendra.aaru@gmail.com)
*
* License MIT
*/
#include <iostream>
#include <stdint.h>