Python Function to Check Unix Passwords

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

701 Views

To verify UNIX password, we should use the crypt module. It has crypt(3) routine. It is basically one-way hash function based on the modified DES algorithm. To use the crypt module, we should import it using. import crypt Method crypt.crypt(word, salt) This method takes two arguments. The first one is the word and second one is salt. The word is basically the user password, which is given in the prompt. The salt is a random string. It is used to perturb the DES Algorithm in one of 4096 ways. The salt contains only Upper-case, Lower-case, Numeric values ... Read More

Difference Between var and dynamic in C#

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

361 Views

Var is strictly typed in C#, whereas dynamic is not strictly typed. Var declaration var a = 10; Dynamic declaration dynamic a = 10; A Var is an implicitly typed variable, but it will not bypass the compile time errors. Example of var in C# var a = 10; a = "Demo"; // gives compile error Example of dynamics in C# dynamic a = 10; a = "Demo"; // won’t give error

POSIX Style TTY Control Using Python

Ankith Reddy
Updated on 30-Jul-2019 22:30:23

557 Views

The termios module provides an interface to the POSIX for tty I/O control. It is only available for Unix system. To use the termios module, we should import it using − import termios All methods in this module, takes the file descriptor as an argument. There are some modules of the termios module, these are − Method termios.tcgetattr(fd) This method returns a list of tty attributes for the given file descriptor. The attributes are iflag, oflag, cflag, lflag, ispeed, ospeed, cc. Method termios.tcsetattr(fd, when, attributes) This method is used to set the attribute from the list of attributes. ... Read More

Terminal Control Functions in Python

Chandu yadav
Updated on 30-Jul-2019 22:30:23

1K+ Views

To change the terminal controls in the Unix system, we can use the tty related methods in Python. Using the tty module, we can set two different modes of the terminal. The raw Mode and the cbreak mode. To use the tty module, we should import it using − import tty There are some modules of the tty module, these are − Method tty.setraw(fd, when = termios.TCSAFLUSH) This method is used to change the terminal mode to raw mode. In the raw mode, the cursor moves to new line but the carriage return operation is not performed. Also ... Read More

Instruction Type SBB R in 8085 Microprocessor

Samual Sam
Updated on 30-Jul-2019 22:30:23

5K+ Views

In 8085 Instruction set, SBB R is mnemonic used for multi-Byte subtraction. Let us consider the following example on such subtraction In this above example, the subtraction of 62H and F1H will result in 71H with a borrow of 1. Next, we have to subtract 44H and 13H along with this borrow value of 1. In the above tracing we have shown you how the internal calculations are being done. Now in 8085, to facilitate such an operation, SBB instruction has been provided to subtract two numbers along with the borrow value. SBB is a mnemonic that stands for ... Read More

Explain Chash Grouping Constructs in Regular Expression

Samual Sam
Updated on 30-Jul-2019 22:30:23

283 Views

There are various categories of characters, operators, and constructs that lets you to define regular expressions. One of them is Grouping Constructs. Grouping constructs describe sub-expressions of a regular expression and capture substrings of an input string. The following table lists the grouping constructs. Grouping construct Description Pattern Matches ( subexpression ) Captures the matched subexpression and assigns it a zero-based ordinal number. (\w)\1 "ee" in "deep" (?< name >subexpression) Captures the matched subexpression into a named group. (?< double>\w)\k< double> "ee" in "deep" (?< name1 -name2 >subexpression) Defines a balancing group ... Read More

Pseudo Terminal Utilities in Python

George John
Updated on 30-Jul-2019 22:30:23

2K+ Views

The Pseudo-terminal utility module pty is defined to handle pseudo-terminal concepts. Using this we can start another process, and also can read or write from controlling terminal using programs. This module is highly platform oriented. We should use UNIX systems to perform these operations. To use the pty module, we should import it using − import pty There are some modules of the pty module, these are − Method pty.fork() This method is used to connect the child controlling terminal to pseudo-terminal. This method returns the pid and the fd. The child process gets the pid 0, but ... Read More

Streams in Java

Fendadis John
Updated on 30-Jul-2019 22:30:23

1K+ Views

Stream is a new abstract layer introduced in Java 8. Using stream, you can process data in a declarative way similar to SQL statements. For example, consider the following SQL statement. SELECT max(salary), employee_id, employee_name FROM Employee The above SQL expression automatically returns the maximum salaried employee's details, without doing any computation on the developer's end. Using collections framework in Java, a developer has to use loops and make repeated checks. Another concern is efficiency; as multi-core processors are available at ease, a Java developer has to write parallel code processing that can be pretty error-prone. To resolve ... Read More

Convert Array to Ordinary List in Python

Arushi
Updated on 30-Jul-2019 22:30:23

160 Views

The array is given. Our task is to convert an array to an ordinary list. We solve this problem with the help of tolist() function. This function return the array as a (possibly nested) list. Algorithm Step 1: Given an array. Step 2: convert the array to a list using tolist() function. Step 3: Display list Example Code #Python program to convert an array to an ordinary #list with the same items from array import * def arraytolist(A): lst = A.tolist() # list print("The List Is ::>",lst) # Driver code A= array('i', [20,30,60]) # array arraytolist(A) Output The List Is ::> [20, 30, 60] The List Is ::> [20, 30, 60]

FCNTL and IOCTL System Calls in Python

Arjun Thakur
Updated on 30-Jul-2019 22:30:23

3K+ Views

To control the files and the io, we should use the fcntl module. It is basically one interface to the fcntl() and ioctl() Unix routines. All methods in this module takes one integer or io.IOBase file-descriptor as their first argument. To use this module, we should import it using. import fcntl There are some modules of the fcntl module, these are − Method fcntl.fcntl(fd, op[, arg]) This method is used to perform the operation on the file using file descriptor. The operation is defined by op. The third argument is optional. It can be either integer type value ... Read More

Advertisements