[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm
raeburn
raeburn at source.lon-capa.org
Wed Aug 10 20:15:07 EDT 2016
raeburn Thu Aug 11 00:15:07 2016 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface loncommon.pm
Log:
- For 2.11
- Backport 1.1233
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.105 loncom/interface/loncommon.pm:1.1075.2.106
--- loncom/interface/loncommon.pm:1.1075.2.105 Sun Aug 7 20:56:23 2016
+++ loncom/interface/loncommon.pm Thu Aug 11 00:15:06 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1075.2.105 2016/08/07 20:56:23 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.106 2016/08/11 00:15:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -16264,11 +16264,19 @@
} else {
$cypher=new DES $keybin;
}
- my $plaintext=
- $cypher->decrypt(unpack("a8",pack("H16",substr($cyphertext,0,16))));
- $plaintext.=
- $cypher->decrypt(unpack("a8",pack("H16",substr($cyphertext,16,16))));
- $plaintext=substr($plaintext,1,ord(substr($plaintext,0,1)) );
+ my $plaintext='';
+ my $cypherlength = length($cyphertext);
+ my $numchunks = int($cypherlength/32);
+ for (my $j=0; $j<$numchunks; $j++) {
+ my $start = $j*32;
+ my $cypherblock = substr($cyphertext,$start,32);
+ my $chunk =
+ $cypher->decrypt(unpack("a8",pack("H16",substr($cypherblock,0,16))));
+ $chunk .=
+ $cypher->decrypt(unpack("a8",pack("H16",substr($cypherblock,16,16))));
+ $chunk=substr($chunk,1,ord(substr($chunk,0,1)) );
+ $plaintext .= $chunk;
+ }
return $plaintext;
}
More information about the LON-CAPA-cvs
mailing list