View | Details | Raw Unified | Return to bug 6200
Collapse All | Expand All

(-)String.pm~ (-10 / +7 lines)
Lines 2-10 Link Here
2
package Razor2::String;
2
package Razor2::String;
3
3
4
use Digest::SHA1 qw(sha1_hex);
5
use URI::Escape;
4
use URI::Escape;
6
use Razor2::Preproc::enBase64;
5
use Razor2::Preproc::enBase64;
7
use Data::Dumper;
6
use Data::Dumper;
8
7
8
BEGIN {
9
  eval  { require Digest::SHA;  import Digest::SHA  qw(sha1_hex); 1 }
10
  or do { require Digest::SHA1; import Digest::SHA1 qw(sha1_hex) }
11
}
12
9
#use MIME::Parser;
13
#use MIME::Parser;
10
14
Lines 70-82 Link Here
70
    die "no ref's allowed" if ref($text);
74
    die "no ref's allowed" if ref($text);
71
75
72
    my $ctx = Digest::SHA1->new;
76
    my $digest = sha1_hex($iv2, $text);
73
    $ctx->add($iv2);
77
    $digest = sha1_hex($iv1, $digest);
74
    $ctx->add($text);
75
    my $digest = $ctx->hexdigest;
76
77
    $ctx = Digest::SHA1->new;
78
    $ctx->add($iv1);
79
    $ctx->add($digest);
80
    $digest = $ctx->hexdigest;
81
78
82
    return (hextobase64($digest), $digest);
79
    return (hextobase64($digest), $digest);
(-)Signature/Whiplash.pm~ (-8 / +6 lines)
Lines 8-12 Link Here
8
package Razor2::Signature::Whiplash; 
8
package Razor2::Signature::Whiplash; 
9
9
10
use Digest::SHA1;
10
BEGIN {
11
  eval  { require Digest::SHA;  import Digest::SHA  qw(sha1_hex); 1 }
12
  or do { require Digest::SHA1; import Digest::SHA1 qw(sha1_hex) }
13
}
11
14
12
sub new { 
15
sub new { 
Lines 684-694 Link Here
684
        # Take the first 20 hex chars from SHA1 and call it the signature.
687
        # Take the first 20 hex chars from SHA1 and call it the signature.
685
688
686
        my $sha1 = Digest::SHA1->new();
689
        $sig = substr sha1_hex($host), 0, 12;
687
690
        $sig .= substr sha1_hex($corrected_length), 0, 4;
688
        $sha1->add($host);
689
        $sig = substr $sha1->hexdigest, 0, 12;
690
691
        $sha1->add($corrected_length);
692
        $sig .= substr $sha1->hexdigest, 0, 4;
693
691
694
        push @sigs, $sig;
692
        push @sigs, $sig;
(-)Signature/Ephemeral.pm~ (-7 / +7 lines)
Lines 3-9 Link Here
3
package Razor2::Signature::Ephemeral;
3
package Razor2::Signature::Ephemeral;
4
use strict;
4
use strict;
5
use Digest::SHA1;
6
use Data::Dumper;
5
use Data::Dumper;
7
6
7
BEGIN {
8
  eval  { require Digest::SHA;  import Digest::SHA  qw(sha1_hex); 1 }
9
  or do { require Digest::SHA1; import Digest::SHA1 qw(sha1_hex) }
10
}
11
8
sub new {
12
sub new {
9
13
Lines 87-100 Link Here
87
91
88
    my $digest;
92
    my $digest;
89
    my $ctx = Digest::SHA1->new;
90
93
91
    if ($seclength > 128) { 
94
    if ($seclength > 128) { 
92
        $ctx->add($section1);
95
        $digest = sha1_hex($section1, $section2);
93
        $ctx->add($section2);
94
        $digest = $ctx->hexdigest;
95
    } else { 
96
    } else { 
96
        debug("Sections too small... reverting back to orginal content.");
97
        debug("Sections too small... reverting back to orginal content.");
97
        $ctx->add($content);
98
        $digest = sha1_hex($content);
98
        $digest = $ctx->hexdigest;
99
    }
99
    }
100
100
(-)Client/Engine.pm~ (-1 lines)
Lines 2-6 Link Here
2
2
3
use strict;
3
use strict;
4
use Digest::SHA1 qw(sha1_hex);
5
use Data::Dumper;
4
use Data::Dumper;
6
use Razor2::Signature::Ephemeral;
5
use Razor2::Signature::Ephemeral;

Return to bug 6200