Showing posts with label System. Show all posts
Showing posts with label System. Show all posts

Tuesday, February 25, 2025

How to Use Derived Data Types in C Programming Language for Efficient Programming

In the C programming language, in addition to basic data types such as int, float, char, and double, there are derived data types that are based on basic types, but offer additional capabilities and flexibility when working with data. Derived data types are types that extend the functionality of primitive types by combining or referencing existing data. They allow the programmer to efficiently manage memory, group data, or define operations. Unlike primitive types, which directly store values, derived types often involve indirection, such as pointers, or the organization of multiple elements, such as arrays.

The main derived data types in the C language are:

Pointers: A data type that stores a memory address, e.g., int*, char* 
 
Arrays: A collection of elements of the same type, e.g., int arr [10]
 
Functions: The return value type of a function, e.g., int function ())

As you can see, in the C programming language, the main derived data types are pointers, arrays, and functions, and user-defined types such as struct, union, and enum are often implicitly included in this category, although they are formally different. We will write about user-defined types in the next blog post. Now we will concentrate only on derived data types that are not user-defined. If you are wondering how functions are a derived data type, then you simply need to know that functions in the C programming language have a type defined by their return value. They are not variables in the classical sense, but they are considered derived types because they allow defining operations on data. We hope this has cleared up any confusion. If anything is unclear, ask in the comments or contact us personally via the contact form on our blog.

A software engineer is considering using derived data types in the C programming language.

A software engineer is considering using derived data types in the C programming language

Pointers are one of the most powerful and characteristic aspects of the C language. They store the address in memory where the data is located, instead of the value itself. This allows for indirect access to data and dynamic memory allocation. Pointers in the C programming language are one of the key elements that make C so flexible and close to hardware. They are both fascinating and challenging, as they allow direct manipulation of memory, but their proper use can significantly improve program performance, while careless handling can lead to problems such as memory leaks and default errors. With pointers, you must code carefully and think carefully about when and how to use them.

Pointer Declaration:

int *ptr;

This means that ptr is a pointer to an integer value, int type specifies the type of data the pointer points to e.g., int, float, char, while * indicates that this is a pointer.

Key Operators:

& Address-of Operator - Retrieves the memory address of a variable.

* Dereference Operator - Accesses or modifies the value at the address stored in the pointer.

          Initialization Example:

int number = 10;

int *ptr = &number; // ptr points to the address of the number variable

Pointer Dereferencing:

    printf("Value at address: %d\n", *ptr); // Prints 10 

Dereferencing means accessing the value at the address that the pointer points to. Arrays in the C programming language are actually pointers to the first element. You can use them to traverse the array. Pointers can be used to pass arguments to functions to allow modifications of the original values. Function pointers allow functions to be called dynamically, based on their address. A pointer can also point to another pointer, allowing multiple levels of indirection. In any case, you will master pointers most easily through practice and coding.

Understanding and Applying Pointers in a Practical Example in C Programming Language

Saturday, November 11, 2017

Kriptografija, heširanje i potpisivanje podataka - 1 deo

 Buy Bitcoins in Minutes

Zaštita podataka i aplikacija je izuzetno kompleksna i opširna stvar i na tu temu bi se mogle napisati mnogobrojne knjige. Iz tog razloga ograničiću se na kriptografiju, heširanje i eventualno na digitalno potpisivanje u čak 3 posta ili 3 dela u kojima ću vam predstaviti čak 29 primera programerskog code-a u C# programskom jeziku kako bi ste se što bolje upoznali sa klasama .NetFramework-a koje na najjednostavniji način obavljaju najkompleksniju enkripciju i dekripciju. Svi primeri su bazirani prema Microsoft primerima sa malo promene, tek toliko da bi se promene uklopile u verziju C# 7.0 bez gubljenja ni jedne linije koda stručnosti. Poznavajući rad sa klasama i metodama System.Security imenskog prostora sami će te u budućnosti lako birati i kombinovati vaš vlastiti način zaštite vaših lozinki, skrivenih poruka, određenih podataka i aplikacija. Opet imajte u vidu da mi nije namera da vas učim hacker-skim veštinama već zaštiti. Za zloupotrebu pre svega programerske inteligencije, pa tek onda hacker-skih veština ste sami odgovorni. Bolje vam je da se usmerite što pre ka vlastitoj kreativnosti i da uspete u životu, nego da vas vaše znanje i talenti koštaju više nego što možete i pretpostaviti.


( Enigma - Nemačka mašina za šifrovanje radio telegrafskih poruka )

Kriptografija je reč grčkog porekla koja znači tajnopis. To je nauka koja se bavi metodama očuvanja tajnosti informacija. Šifre i digitalni potpisi su kriptografske tehnike koje se koriste da bi se implementirali bezbednosni servisi. Enkripcija vam je samo drugi naziv za šifrovanje podataka dok je deskripcija, koju češće zovemo dekripcija dešifrovanje podataka. Prva kriptografija vam se koristila čak u  vreme Julija Cezara i on se smatra prvim vojskovođom koji je koristio kriptografiju u svojim bitkama. Jednostavno je koristio abecedu i sva slova pomerao za par mesta i na taj način ih šifrovao. Njegove poruke su mogli da dešifruju samo oni koji su poznavali “pomeri za“ pravilo. Još pre računara postojalo je mnoštvo tehnika za šifrovanje poput “vižnerova šifra“, “playafairova šifra“ itd. Danas zahvaljujući računarima, ali i kriptografskoj podršci kroz .NetFramework klase, vama je omogućeno da bezbedno razmenjujete važne ključeve, sprečavate prisluškivanje, otkrivate izmene u porukama, generišete jednosmerne heševe za čuvanje lozinki i pravite digitalne potpise.

Kako da enkriptujete i dekriptujete podatke koristeći Aes klasu?