Key

Share

What is a Key on the Computer?

The term "key" has several meanings in a computer!

A key can be a key of a keyboard, which is a board full of keys on it.

A photo of a white keyboard.
A white keyboard. Photo: Nikky via Flickr. License: CC BY-SA 2.0.

A key can be a text code or some technology that unlocks access to something, e.g. a passkey.

In cryptography, the term key refers to something used to decrypt a piece of encrypted data, or to authenticate that it originated from a source and wasn't tampered by someone during transfer, e.g. private keys, public keys, GPG keys, etc. SSL certificates also fall in this category. When we say an application is "signed," we're saying it was cryptographically signed with a key so we can tell it wasn't tampered..

In programming, a key is the indexing component of a key-value map. In such mapping, we map values to keys, and retrieve values from such data structure by providing the respective key. For example, if we a key-value map that mapped names of people to their phone numbers, the key is the "name of the person" and the value would be their phone number, so we could provide the name "John" to retrieve John's phone number.

In table-based relational database management systems (RDBMS's), a primary key (PK) is the indexing component of a table, a set of columns that uniquely identifies every row in the table, such that no two rows in the table may have the same values in those same columns. Generally this primary key is an incrementing integer, such that the first row has the PK 1, the second row has the PK 2, the third the PK 3, and so on. A table that has a column that is naturally unique (and as such doesn't need an incrementing integer) is said to have a natural primary key, e.g. a table that can only have one row per day and has a column for the date could have the date column as its primary key since no two rows can ever have the same date. A foreign key (FK) is a set of columns in one table that uniquely identifies a row in another table.

Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments