Access Rights using Binary Masks

Imagine a building with 8 rooms.

Binary-Mask-Room-Layout

Each room is fitted with a card reader used to give access or not to different members of staff.
Each member of staff has a card giving them access to some of the rooms.
The card is used to store an access code:

Access-Card-XL-1

This card gives access to:

  • Room 3,
  • Room 5,
  • Room 8.

Hence the Access Code: 00101001

Task 1: Access Denied!


Complete the following table to show which rooms these cards will give access to:

Access Card Room Access
Binary-mask-access-card-1
Binary-mask-access-card-2
Binary-mask-access-card-3
Binary-mask-access-card-4

Task 2: Centralised Override! – AND Mask


The site manager can control access to all the rooms by disabling or enabling access to specific rooms. He can do so by setting a access code mask consisting of 8 bits.
For instance the access mask 00001111 would mean that only rooms 5,6,7,8 are accessible (by authorised card holders) while rooms 1,2,3 and 4 are completely locked.

The locking system at the door uses both the access code of the staff member’s card and the building access mask to decide if a staff member can unlock a room:

Access-Card-AND-Mask

This means that this member of staff can only access room 5 and room 8. This operation consists of applying an AND mask to determine the resulting room access code.

Considering the following Access Mask:

00110011

Perform the AND mask filter to work out which rooms these staff cards will give access to.

Access Card Room Access
Binary-mask-access-card-1
Binary-mask-access-card-2
Binary-mask-access-card-3
Binary-mask-access-card-4

Task 3: Multiple Cards Access! – OR Mask


On specific occasions, a staff member is allowed to borrow a card from one of their colleagues. This may give them access to additional rooms. Using an OR mask between two access cards code we can figure out all the rooms an employee with two cards can have access to.

Access-Card-OR-Mask

Use an OR mask with the following cards access code to determine which rooms these sets of two cards will give access to:

Access Card 1 Access Card 2 Room Access
Binary-mask-access-card-1 Binary-mask-access-card-2
Binary-mask-access-card-1 Binary-mask-access-card-4
Binary-mask-access-card-3 Binary-mask-access-card-2
Binary-mask-access-card-4 Binary-mask-access-card-2
Share Button
Posted in Computer Science, Computing Concepts Tagged with:

Our Latest Book

Follow this blog