Prepare for the A Level Computer Science OCR Exam with engaging quizzes, detailed explanations, and effective study tips. Maximize your readiness and boost your confidence for exam day!

Practice this question and more.


In cryptography, what does hashing provide?

  1. Variable key lengths

  2. Fixed-length strings

  3. Data encryption

  4. Data compression

The correct answer is: Fixed-length strings

Hashing is a technique used in cryptography that generates a fixed-length string of characters, regardless of the length of the input data. This means that when any size of data is processed through a hashing algorithm, the output will always be of the same fixed length. This characteristic of producing a consistent output size is essential for various applications, including data integrity verification and efficient storage. When a hashing function is applied, it maps the input data to a hash value, which serves as a unique identifier for that specific set of data. This unique characteristic is particularly useful because it helps ensure that even the slightest change in the input will produce a vastly different hash, allowing for the detection of alterations or corruption in the data. The other options do not align with the primary purpose of hashing. Variable key lengths are related to encryption methods rather than hashing. Data encryption involves transforming data into a coded format, while data compression refers to reducing the size of the data. Hence, the focus of hashing is uniquely centered on generating fixed-length strings that represent data.