一段生成linux passwd的perl脚本

Posted on 2006-03-03 15:38  Jerry Ren  阅读(283)  评论(0编辑  收藏  举报
脚本如下,最终是用crypttext来加密。不懂的是中间这句,my$plaintext=shift;
有了解的讲解一下。
#!/usr/bin/perl
srand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
my $plaintext = shift;
my $crypttext = crypt ($plaintext, $salt);
print "${crypttext}\n";

Copyright © 2025 Jerry Ren
Powered by .NET 9.0 on Kubernetes