What is a mask?(What is, Concept and Definition)

In reference to computers, a mask is a special value that acts as a data filter.It is called a "mask" because it reveals some parts of digital information and hides or alters others.

Bitmasks


In binary operations, a bitmask can be used to filter out bit values ​​using logical operations.For example, a bitmask of 00001111 an operand of the Boolean AND operation, converts the first four bits of the other operand to 0 .The last four bits will not be modified.This operation is called "masking" the first four bits, changing them a 0 .


If the OR operator is used, any 1 value in the bitmask will produce a 1 in the corresponding result, and others will remain bits unaltered.So a bitmask of 00001111 , used with OR , will "mask" the last four bits, changing them to 1 .


If the XOR operator is used, any 1s in the bitmask causes the corresponding bits in the operand to be activated- 1 becomes 0 , and 0 becomes 1 .


















00001111 00001111 00001111 00001111
AND AND OR XOR
11010010 01101101 10010110 01011010
00000010 00001101 10011111 01010101

Netmask


A netmask is another type of bitmask, used in computer networks.One type of netmask, a subnet mask, defines the logical divisions ("subnets") of a computer network.For example, a subnet mask of 255.255.255.0 masks the first three bytes of an IP address, leaving only the final byte: the host identifier.


Search masks


In Microsoft Windows, a search mask is a string, which can contain wildcards, that filters search results.It is commonly used to search for files by name.For example, in the command:

forfiles/m "s *.exe"

The s *.exe search mask is used by the forfiles command to locate all the.exe files in the current directory whose name it starts with s .


Umask


On Unix-like operating systems, such as Linux, BSD, and macOS X, a umask is an octal value mask that defines the permissions for new files.


For information on creating user file masks in Linux, see umask in our Linux command guide.

Comments