Teshehashingassignment PDF
Teshehashingassignment PDF
ASSIGMENT
submission date:13-05-2015
· Hashing in the data structure is used to quickly identify a specific value within a given array.
· It creates a unique hash code for each element in the array and then stores the hash code
instead of the actual element.
· This allows for quick lookup when searching for a specific value, as well as easy identification of
any duplicates. Hashing in the data structure is a technique that is used to quickly identify a
specific value within a given array.
· It works by creating a unique hash code for each element in the array and then stores the hash
code in lieu of the actual element.
· This allows for quick look-up when searching for a specific value, as well as easy identification of
any duplicates. The data structure's hash function validates the imported file using a hash
value. You may quicken the process by using the item's hash key.
· It improves search efficiency and retrieval effectiveness. This is a straightforward method for
defining hashing in a data structure. Hashing is an important tool to have in your arsenal when
constructing data structures and can be used in many different ways.
· The data structure's hash function validates the imported file by using a hash value. You may
quicken the process by using the item's hash key.
· It improves search efficiency and retrieval effectiveness. This is a straightforward method for
defining hashing in a data structure.
· Hashing is an important tool to have in your arsenal when constructing data structures and can
be used in many different ways.
· However, you'll need to spend a lot of time searching through the full list to find that particular
number. Not only is this manual scanning technique time-consuming, but it is also ineffective.
You may speed up the search and locate the number by hashing the data structure.
· To make things easier for you, KnowledgeHut brings comprehensive skill-oriented online courses
to learn the nitty gritty of data science and programming language.
· Hashing involves changing one value into another based on a specified key or string of
characters. The original string is often represented with a smaller, fixed-length value or key,
which makes it simpler to locate or use.
· Implementing hash tables is the most well-liked use of hashing. A list that may be accessed by
using a hash table's index contains key and value pairs. The hash function helps map the keys to
the table size since key and value pairs are infinite. The value for a given element is then
changed to a hash value.
· Utilizing algorithms or functions, hashing converts object data into a useful integer value. Once
these things have been located on such object data map, queries can be filtered using a hash.
· For instance, developers store data, such as a customer record, as key and value pairs in hash
tables. Hash codes are then mapped to integers of a predetermined size, while keys are used to
identify data and are input to the hash function.
2. Digital Signatures
· In addition to allowing quick data retrieval, hashing aids in the encryption and decryption of
digital signatures that are used to verify message senders and recipients. In this case, the digital
signature is changed by a hash function before the hashed value or a message digest, and the
signature is transmitted separately to the recipient.
· When a message is received, the same hash function uses the signature to create the message
digest, which is then compared to the message digest that was transmitted to make sure they
are identical. The hash function indexes the initial value or key and makes data linked to a
particular value or key that is obtained accessible in a one-way hashing operation.
Hashing in data structure pertains to a method of breaking up a huge amount of data into smaller
tables. Also known as the message digest function, it is a method for distinguishing one distinct object
from a group of related ones. By condensing the original input strings and data assets to short
alphanumeric hash keys, developers and programmers can reduce both time and file space.
· Hashing assists in focusing a search for a particular item on a data map. Hash codes create an
index to hold values in this scenario. Therefore, hashing is employed to index and retrieve data
from a database since it speeds up the process; finding an item using a smaller hashed key than
just its original value is much simpler. is employed in this situation to index and retrieve data
from a database since it speeds up the process; it is much simpler to find an item using a smaller
hashed key than just its original value.
· Hash tables are used to store the data in an array format. There is a unique index number for
each value within the array. Hash tables create these distinct index numbers for each value
stored in an array format using a method that they use, called the hash technique.
In Schools - Each student in a class is assigned a unique roll number for easy identification. The school
authority, later on, uses the unique roll number to retrieve relevant information about the particular
student.
In diagnostic centers and laboratories - Medical laboratories use unique serial numbers to identify and
distinguish patient samples and patient information.
Security Purposes - One must take precautions to ensure that the account does not end up in the wrong
hands when they first visit a website that requests authentication through "Sign Up" and where they
submit the login information to access the personal accounts. As a result, the database stores the
entered password as a hash.
· In data structures, hashing is a technique used to store and retrieve data in a database. It is
fundamental to many data structures, such as hash tables and hash trees. Hashing involves
mapping data to a unique value, called a hash code. The hash code is then used to index into an
array, where the data is stored. To retrieve the data, the hash code is simply re-computed and
used to index into the array.
· Hashing is an efficient way to store and retrieve data in a data structure because it avoids the
need for comparisons between elements. It also allows duplicate values to be stored in the same
structure without causing collisions.
· Hashes are typically generated using a hashing algorithm, which takes an input and produces a
hash code. There are many different hashing algorithms, but they all share the same basic
principle: map data to a value that can be used to index into an array. Some popular hashing
algorithms include SHA-1, MD5, and MurmurHash.
· It is particularly useful for storing and retrieving data from large collections.
· In a nutshell, hashing works by mapping data to a hash code, which is then stored in a hash
table. When data needs to be retrieved, the hash code is used to look up the data in the hash
table.
· Hash tables are often used for quick lookup data, such as in caches and databases. One key
advantage of hashing is that it can store data of any type, including integers, strings, and objects.
· Furthermore, hashing is relatively simple to implement and efficient when done correctly. As a
result, hashing is frequently used in computer programming. is frequently used in computer
programming.
· Separate chaining is the most used collision hashing technique in data structures that uses a
lined list. Any two or more components that meet at the same point are chained together to
form a single-linked list known as a chain. Every linked list member that hashes is chained to the
same position here. Also known as closed addressing, open hashing is used to avoid any hash
collisions, using an array of linked lists in order to resolve the collision.
Advantages
· As there are a lot of empty spaces in the hash table, we can add more keys to the table.
· Mostly used when unsure about the amount and frequency of the keys to be implemented in
the hash table.
Disadvantages -
· Wastage of space
· With a long chain, the search time is increased
· Open addressing stores all entry records within the array itself, as opposed to linked lists. The
phrase 'open addressing' refers to the notion that the hash value of an item does not identify its
location or address.
· In order to insert a new entry, the array is first checked before computing the hash index of the
hashed value, starting with the hashed index. If the space at the hashed index is empty, the
entry value is inserted there; otherwise, some probing sequences are used until an empty slot is
found.
· The procedure used to navigate through entries is known as the probe sequence. You can vary
the time between succeeding entry slots or probes in different probe sequences.
· In Closed hashing, there are three techniques that are used to resolve the collision:
a) Linear Probing
· Linear probing involves systematically checking the hash table from its very beginning. A
different site is searched if the one received is already occupied. In linear probing, the interval
between the probes is usually fixed (generally, to a value of 1).
b) Quadratic Probing
· The only distinction between linear and quadratic probing is the space between succeeding
probes or entry slots. When a hashed index slot for an entry record is already taken, you must
start traversing until you discover an open slot. The spacing between slots is calculated by adding
each subsequent value of any arbitrary polynomial in the initial hashed index.
c) Double-Hashing
· It is another hash function that determines the intervals between probes. An optimized method
of reducing clustering is double hashing. An additional hash function is used to calculate the
increments for the probing sequence.
K
The ' ey' in Hashing
· Hashing Key is the raw data that has to be hashed in a hash table. The hashing algorithm carries
out a function to translate the hash key into the hash value. The outcome of feeding the hash
key through the hashing algorithm is what is known as the hash value.
· Private key - The private key is employed in both encryption and decryption. Each party that
sends or receives sensitive information that has been encrypted shares a key. Due to the fact
that both parties share it, the private key is also referred to as "symmetric". A private key is
typically a long, impossible-to-guess string of bits generated at random or artificially random.
· SSH public key - SSH uses both a public and a private key. SSH is a set of keys that can be used to
authenticate and decrypt a communication sent from a distance. Both the distant servers and
the stakeholders have access to the public key.
· An array format is used to store hash table data, where each value is assigned its unique index.
By knowing the index of the desired data, we can access it very quickly.
· As a result, inserting and searching data is very fast, regardless of data size. In a Hash Table,
elements are stored in an array, and an index is generated using hashing techniques in a data
structure.
F
Hash unction
· A key is transformed into a hash key through a fixed process in hash functions. Hash values are
length-restricted values that can be derived from a key. Despite the fact that the hash value is
usually less than the original, the original sequence of characters is still reflected in the hash
value.
· Following the transfer of the digital signature, the recipient receives both the hash value and the
digital signature. A comparison is made between the hash value generated by the receiver and
the one received along with the message using the same hash algorithm. Messages are sent
without error if their hash values match exactly.
· A collision-free hash function ensures that no two input hash maps out the same output hash.
· Property to be hidden - A hash function is used to map data of arbitrary size to fixed-size data.
One key characteristic of a good hash function is that it should be hard to guess the input value
from its output.
· In other words, it should be difficult to find two different inputs that produce the same output.
The output should be evenly distributed across all possible values. This ensures that every
possible input will have a unique output and that the outputs will be spread evenly throughout
the range of possible values.
· Puzzle friendly – A hash function is ought to be suitable for puzzles. The choice of an input that
yields a predetermined result ought to be challenging.
· As a result, it is best to choose the input from a range that is as diverse as feasible.
Division Method, Mid Square Method, Folding Method and Multiplication Method.
· The division method is the simplest and easiest method used to generate a hash value. In this
hash function, the value of k is divided by M and uses the remainder as obtained.
· The steps involved in computing this hash method include the following -
3. Folding Method
i) The key-value k should be divided into a specific number of parts, such as k1, k2, k3,..., kn, each
having the very same number of digits aside from the final component, which may have fewer digits
than the remaining parts.
ii) Add each component separately. The last carry, if any, is disregarded to determine the hash value.
4. Multiplication Method
Steps to follow :-
iv) Take the result of the previous step and multiply it by the size of the hash
table , M.
(Where , M = size of the hash table , k = key value and A = constant value)
Hash Collision?
· A hash collision happens when the same hash value is produced for two different input values by
a hash algorithm. But it's important to point out that collisions aren't a problem; they're a
fundamental aspect of hashing algorithms.
· Collisions occur because different hashing techniques in data structure convert every input into a
fixed-length code, regardless of its length. Since there are an endless number of inputs and a
limited number of outputs, the hashing algorithms will eventually produce repeating hashes.
Conclusion
· When compared to any other data structure, hashing provides a more secure and adjustable
method of retrieving data.
· Arrays and lists can be searched more quickly in hashing, meaning you can find the index of the
required item in no time with just a few operations using this method.
· As a result, hashing plays a crucial role in information security by ensuring that messages are not
altered during transmission. As well as encoding and decoding advanced marks and digital
signatures, it provides security for sensitive data.
Hashing is mostly used for database recovery since using a small hash key to find anything is quicker
than using the original value. The information can also be determined if indistinguishable without
opening or comparing them.
<END>