Acme-DRM

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

Build.PL
Changes
lib/Acme/DRM.pm
Makefile.PL
MANIFEST			This list of files
t/00-load.t
t/doubleROT128.t
t/pod-coverage.t
t/pod.t
t/secureXOR.t
README
META.yml
SIGNATURE    Added here by Module::Build

README  view on Meta::CPAN

NAME
    Acme::DRM - Library providing cryptographic capabilities especially
    suited for Digital Rights Management. Protects against Pirates. May
    increase global warming. Note: Not guaranteed to protect against Pirates
    or increase global warming.

VERSION
    Version 0.03

SYNOPSIS
     use Acme::DRM qw(secureXOR doubleROT128);
     my $intellectualProperty = 'One-hit Wonder Music';

     # Encrypt your IP to plug the digital hole
     my $encryptedContent = secureXOR($intellectualProperty);

     # Invoke the DMCA by encrypting your data, without invoking 
     # additional overhead for decryption at runtime
     my $protectedContent = doubleROT128($intellectualProperty);

EXPORT
    secureXOR
    doubleROT128

FUNCTIONS
  secureXOR
    XOR is an extremely convenient method for encrypting a digital media
    stream. Given any two of the a) original data, b) encryption key, and c)
    encrypted data, you get the third item. Unfortunately, hackers have
    compromised the effectiveness of this computationally convenient method.
    The weakness is the reuse of a single key. The answer is to use a
    variable key, however, key distribution becomes a difficult proposition.
    If the key is distributed in the clear, pirates can simply decrypt the
    digital media stream, and steal your Intellectual Property. Our solution
    is to use the media itself as the key. This function conveniently takes
    only the media as a single argument, and automatically XORs the

README  view on Meta::CPAN

    hacker-proof, except for one exception: the encrypted datastream is
    exactly the same length as the original data, but this is almost never
    probably a weakness. This algorithm does guarantee that your original
    data will not be recoverable from the encrypted stream without the
    proper key. Additionally, use of an incorrect key will not provide
    hackers with any sort of clue that they have guessed an incorrect key.

  doubleROT128
    This function exists to provide a method by which you can protect your
    Intellectual Property under the DMCA, without imposing the difficulty of
    implementing a separate, potentially insecure decryption algorithm in
    your secure media playback application. Simply pass your digital media
    to this function, and it will output an encrypted stream, conveniently
    passed twice internally through a strong ROT-128 encryption algorithm.
    The resulting encrypted content cannot be legally decrypted by a hacker,
    since you encrypted it to protect it from hackers and pirates. Further,
    you can pass the content through this algorithm multiple times for
    enhanced protection. Decryption can be performed by either passing the
    encrypted datastream back through this algorithm, or in many cases, the
    encrypted stream itself can be used by the playback function.

AUTHOR

SIGNATURE  view on Meta::CPAN

SHA1 8b8b84915a6972b473099b3ec8af9453861150f6 Changes
SHA1 c230edf167e81a9a7bf032e8e4cdadf5870e8bee MANIFEST
SHA1 5f5263af6dd33fa08bf2838361e3961771e51a77 META.yml
SHA1 cd14ada78fb37a0d926edd86eddcdf7f939de582 Makefile.PL
SHA1 7458d0558314c45720a382362395992cfc0fb07c README
SHA1 c2a67eec06c3c50d44c6de21b4112276c1f16f95 lib/Acme/DRM.pm
SHA1 9f3a16ddcd38d60cafabb35b697dcd25286789bb t/00-load.t
SHA1 5c78f38cbcbf39615397012496ddf722a75def92 t/doubleROT128.t
SHA1 6da39b48ce64b584e4c3274bff96fc76ff484820 t/pod-coverage.t
SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t
SHA1 d10b40287bcdbfaaba708719d7b48537000a97e7 t/secureXOR.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF53IEg+xEL6ZC5lERAvwaAJ9Q1UdB0uqVteH+jT2WjUS4IQvauQCffvs1
bp3tF/BfGq9bF5/BSfcf06Q=
=d/Ho
-----END PGP SIGNATURE-----

lib/Acme/DRM.pm  view on Meta::CPAN

=head1 VERSION

Version 0.03

=cut

$VERSION = '0.03';

=head1 SYNOPSIS

 use Acme::DRM qw(secureXOR doubleROT128);
 my $intellectualProperty = 'One-hit Wonder Music';

 # Encrypt your IP to plug the digital hole
 my $encryptedContent = secureXOR($intellectualProperty);

 # Invoke the DMCA by encrypting your data, without invoking 
 # additional overhead for decryption at runtime
 my $protectedContent = doubleROT128($intellectualProperty);

=cut

=head1 EXPORT

=cut

require Exporter;
@ISA = qw(Exporter);

=over 4

=item B<secureXOR>

=cut

push( @EXPORT_OK, '&secureXOR' );

=item B<doubleROT128>

=cut

push( @EXPORT_OK, '&doubleROT128' );

=back

=head1 FUNCTIONS

=head2 secureXOR

XOR is an extremely convenient method for encrypting a digital media stream.  Given any two of the a) original data, b) encryption key, and c) encrypted data, you get the third item.  Unfortunately, hackers have compromised the effectiveness of this ...
The answer is to use a variable key, however, key distribution becomes a difficult proposition.  If the key is distributed in the clear, pirates can simply decrypt the digital media stream, and steal your B<Intellectual Property>.  Our solution is to...

=cut

sub secureXOR {

  # Get the first argument
  my $data = shift;

  # Make sure we really got something
  unless ( defined($data) ) {
    return;
  }

  # Where we'll collect the output
  my @output;

  # Break the data into individual bytes
  my @data = unpack( 'C*', $data );

  # Iterate over each byte
  for my $byte (@data) {

    # Protect each byte with the secure variable-key
    # XOR algorithm
    push( @output, $byte ^ $byte );
  }

  # Re-encode the encrypted data and output it as a single stream
  return ( pack( 'C*', @output ) );
}

=head2 doubleROT128

This function exists to provide a method by which you can protect your B<Intellectual Property> under the DMCA, without imposing the difficulty of implementing a separate, potentially insecure decryption algorithm in your secure media playback applic...
Simply pass your digital media to this function, and it will output an encrypted stream, conveniently passed twice internally through a strong ROT-128 encryption algorithm.  The resulting encrypted content cannot be legally decrypted by a hacker, sin...

=cut

sub doubleROT128 {

  # Get the first argument
  my $data = shift;

  # Make sure we got something

lib/Acme/DRM.pm  view on Meta::CPAN

  for my $byte (@data) {

    # Marvel at the beauty of this algorithm

    # Left shift 4 bits -- this makes the number 12 bits, lower 4 bits are all 0
    $byte = $byte << 4;

    # Rotate the high 4 bits back around to make this an 8-bit value again
    $byte = ( $byte / 2**8 ) + ( $byte % 2**8 );

    # Now rotate it again for twice the security
    $byte = $byte << 4;
    $byte = ( $byte / 2**8 ) + ( $byte % 2**8 );

    # And collect the output
    push( @output, $byte );
  }

  # Re-encode the encrypted stream and output it
  return ( pack( 'C*', @output ) );
}

t/doubleROT128.t  view on Meta::CPAN


# Import useful testing functions
use Test::More tests => 6;


# Make sure module is loadable
BEGIN { use_ok( 'Acme::DRM', qw(doubleROT128) ); };

require_ok( 'Acme::DRM' );

# Now try to use secureXOR
my $sampleASCII = 'This is my song it has a beat it is so cool LOLLERS!';
my $sampleBIN   = pack('C*', 0x23, 0xc9, 0xa2, 0x55, 0xaa, 0xfe, 0xde, 0xad);

my $encASCII = doubleROT128( $sampleASCII );
my $encBIN   = doubleROT128( $sampleBIN );

# Make sure the encoded string is of the same length as the input
is( length( $encASCII ), length( $sampleASCII ),
	'Encoded ASCII should be same length as sample',
);

t/secureXOR.t  view on Meta::CPAN

#!/usr/bin/perl -wT
use strict;

# Import useful testing functions
use Test::More tests => 6;


# Make sure module is loadable
BEGIN { use_ok( 'Acme::DRM', qw(secureXOR) ); };

require_ok( 'Acme::DRM' );

# Now try to use secureXOR
my $sampleASCII = 'This is my song it has a beat it is so cool LOLLERS!';
my $sampleBIN   = pack('C*', 0x23, 0xc9, 0xa2, 0x55, 0xaa, 0xfe, 0xde, 0xad);

my $encASCII = secureXOR( $sampleASCII );
my $encBIN   = secureXOR( $sampleBIN );

# Make sure the encoded string is of the same length as the input
is( length( $encASCII ), length( $sampleASCII ),
	'Encoded ASCII should be same length as sample',
);
is( length ($encBIN ), length( $sampleBIN ),
	'Encoded BIN should be same length as sample',
);

# Make sure the encoded data is all nulls



( run in 0.848 second using v1.01-cache-2.11-cpan-39bf76dae61 )