Sample Exam Questions

From the objective of OSS-DB Exam Gold
- Advanced Server Administration - Setting up database server

Sample Question

1.01

Which of the following is the correct definition of the crypt function?

  1. Encrypts data by specifying a symmetric key

  2. Calculates a binary hash of the data

  3. Performs password hashing

  4. Computes the hashed MAC of the data

  5. Creates a new random salt string to be used when hashing passwords

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2025/05/29

Answer and Explanation

The correct answer is "C. Performs password hashing".

postgresql can encrypt stored data so that it cannot be deciphered.
The crypt function can be used to hash passwords.
It is used in conjunction with the gen_salt function when adding data to a table, as shown below.

insert into test(id,name,password) values(1,'user1',crypt('password',gen_salt('md5')));

Each option is explained below.

A. Encrypts data by specifying a symmetric key
Incorrect.
The above is a description of the pgp_sym_encrypt function.
pgp_sym_encrypt(data text, psw text [, options text ]) returns bytea
Encrypts data with the symmetric PGP key psw.

B. Calculates a binary hash of the data
Incorrect.
The above is a description of the digest function.
digest(data text, type text) returns bytea
Computes the binary hash of the given data. type is the algorithm to be used.
By default, the following algorithms can be specified.
md5, sha1, sha224, sha256, sha384, sha512

C. Performs password hashing
Correct.

D. Computes the hashed MAC of the data
Incorrect.
hmac(data text, key text, type text) returns bytea
The above is a description of the hmac function.
It computes the hashed MAC of data with key as the key.
The hash can only be recalculated if the key is known.

E. Creates a new random salt string to be used when hashing passwords
Incorrect.
The above is a description of the gen_salt function.
When storing a new password during password hashing, a new salt must be generated using the gen_salt function.