summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6b0fd4c)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@409
c11ca15a-4712-0410-83d8-
924469b57eb5
return 0 if ( -f $file{PID});
}
return 0 if ( -f $file{PID});
}
+sub mkcrypt {
+ my($str) = @_;
+ my $salt = join '',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64];
+
+ return crypt($str, $salt);
+}
+
- if ($message =~ /^crypt\s+(\S+)\s*(?:,| )\s*(\S+)/) {
- # word salt.
- &pSReply(crypt($1, $2));
- return;
- }
+ if ($message =~ /^crypt(\s+(.*))?$/i) {
+ my @args = split /\s+/, $2;
+
+ if (!scalar @args or scalar @args > 2) {
+ &help("crypt");
+ return;
+ }
+
+ if (scalar @args == 2) {
+ if (length $args[0] != 2) {
+ &msg($who, "invalid format...");
+ return;
+ }
+ &pSReply( crypt($args[1], $args[0]) );
+ } else {
+ &pSReply( &mkcrypt($args[0]) );
+ }
# cycle.
if ($message =~ /^(cycle)(\s+(\S+))?$/i) {
# cycle.
if ($message =~ /^(cycle)(\s+(\S+))?$/i) {