Acme-DRM

 view release on metacpan or  search on metacpan

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

  # 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
  unless ( defined($data) ) {
    return;
  }

  # Where to keep the output as individual bytes
  my @output;

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

  # Protect each byte individually, and accumulate the results
  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 ) );
}

=head1 AUTHOR

Brett T. Warden, C<< <bwarden-cpan@wgz.org> >>

=head1 BUGS

Please report any bugs or feature requests to
C<bug-acme-drm@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-DRM>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.

=head1 ACKNOWLEDGEMENTS

Thanks to the lobbyists behind the DMCA and the politicians who bought (or
were bought) into the great idea of assigning corporate greed higher value
than constitutionally-asserted citizen rights.

=head1 COPYRIGHT & LICENSE

Copyright 2005-2007 Brett T. Warden, all rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut

1;    # End of Acme::DRM



( run in 2.342 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )