神刀安全网

Password Input with getPass

(This article was first published on R – librestats , and kindly contributed toR-bloggers)

As of this morning, the getPass package version 0.1-1 is available on CRAN. The package offers a portable way to read user input without echoing the text, for the purposes of reading passwords. Some screenshots from various platforms are given below.

Password Input with getPass

Implementation details are described in the package vignette . The short version is, if you use…

  • RStudio , input is handled by the rstudioapi package
  • command line (any OS), a custom reader written in C is used
  • RGui (Windows), then a tcltk reader is used.
  • R.app (Mac), then we attempt to use tcltk if it is available.

If none of these options is available for your platform/interface, then a backup version without masking can be used, via R’s readline() . I believe this supports just about everything, except emacs+ess, which I don’t think can be supported (if you have any ideas, please let me know). If you discover any problems, please file an issue .

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Password Input with getPass

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址