Acme-DRM
view release on metacpan or search on metacpan
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
datastream with a copy of itself, rendering the stream almost completely
unrecoverable without the key: the media itself. This is virtually
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
lib/Acme/DRM.pm view on Meta::CPAN
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) ) {
t/doubleROT128.t view on Meta::CPAN
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',
);
is( length ($encBIN ), length( $sampleBIN ),
'Encoded BIN should be same length as sample',
);
# Make sure the encoded data is identical to the input
is( $encASCII, $sampleASCII,
'Encoded ASCII should be the same as sample',
);
is( $encBIN, $sampleBIN,
'Encoded BIN should be the same as sample',
);
t/secureXOR.t view on Meta::CPAN
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
like( $encASCII, qr/^\0*$/,
'Encoded ASCII should be all nulls',
);
like( $encBIN, qr/^\0*$/,
'Encoded BIN should be all nulls',
);
( run in 1.780 second using v1.01-cache-2.11-cpan-94b05bcf43c )