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

(-)Bayes.dist.pm (+29 lines)
Lines 405-410 Link Here
405
    # now do some token abstraction; in other words, make them act like
405
    # now do some token abstraction; in other words, make them act like
406
    # patterns instead of text copies.
406
    # patterns instead of text copies.
407
407
408
    # Chris Thielen Anti Obfu Proof of Concept patch
409
    # 2004-01-08
410
    if (!$in_headers)
411
    {
412
        my $tokcpy = $token;
413
        # nuke all non-alphas.
414
	$tokcpy =~ s/^sk://; # optimize this; we check if it happened later
415
        $tokcpy =~ tr/A-Za-z//cd;
416
        # case insensitive. (good? bad?)
417
        $tokcpy =~ tr/A-Z/a-z/;
418
        # sort the chars in string
419
        $tokcpy = join('',sort(split(//,$tokcpy)));
420
        if ($tokcpy)
421
        {
422
	    $tokcpy = "sk:".$tokcpy if $token =~ m/^sk:/;
423
            # add token
424
                push (@{$self->{tokens}}, $tokprefix.$tokcpy); $wc++;
425
            # remove any repeated chars
426
	    my $tokcpycpy = $tokcpy;
427
            $tokcpy =~ tr/A-Za-z/A-Za-z/s;
428
	    dbg("BAYES TRANSLATE: $token: $tokcpycpy, $tokcpy");
429
            if ($tokcpy)
430
            {
431
                # add token
432
                push (@{$self->{tokens}}, $tokprefix.$tokcpy); $wc++;
433
            }
434
        }
435
    }
436
408
    # replace digits with 'N'...
437
    # replace digits with 'N'...
409
    if ($token =~ /\d/ && (!$in_headers || !NO_NUMERIC_IN_HEADERS))
438
    if ($token =~ /\d/ && (!$in_headers || !NO_NUMERIC_IN_HEADERS))
410
    {
439
    {

Return to bug 2908