Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

seehuhn/password

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reading Password on the Command Line in Go

Some of the code in this package is taken from code.google.com/p/go/crypto/ssh/terminal and then has been modified by Jochen Voss. The original code is distributed under the following license:

Copyright 2011 The Go Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.

All added code and all changes to the original code are distributed under the following license:

Copyright 2013 Jochen Voss. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.

Installation

This package can be installed using the go get command:

go get github.com/seehuhn/password

Usage

The following command can be used to read a password from the command line:

input, err := password.Read("passwd: ")

This switches of echoing of input to the terminal, prints the given prompt to the screen, reads input from standard input until the end of line, and finally restores the original terminal settings. The byte slice returned does not include the terminating end-of-line character.

About

Reading Password on the Command Line in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages