> On Nov 9, 2016, at 10:35 AM, MacQueen, Don <macque...@llnl.gov> wrote:
> 
> Bob,
> 
> Thanks for responding. I've tried the functions in bcrypt, and get, for
> example,
> 
>> infl <- 'path.to.the.encrypted.file'
>> junk <- 'the.password'
>> foo <- readLines(infl)
> Warning message:
> In readLines(infl) :
>  incomplete final line found on 'path.to.the.encrypted.file'

I would not have expected that to succeed. readLines drops cr's and lf's and it 
certainly seems possible that those characters might be encrypted values 
randomly sprinkled through the image. What happens when you read it as raw? 
(may need to first get `file.info` to determine file length.)

perhaps something along the lines of 

foo <- readBin( infl, "raw", file.info(infl)[1, "size"])

-- 
David


>> tmp <- checkpw(junk, foo)
> Error in hashpw(password, hash) : Invalid salt
> 
> Thus demonstrating that I don't know what I'm doing.
> 
> If it's easy to expand, as you mention, I would indeed appreciate it.
> 
> -Don
> 
> 
> -- 
> Don MacQueen
> 
> Lawrence Livermore National Laboratory
> 7000 East Ave., L-627
> Livermore, CA 94550
> 925-423-1062
> 
> 
> 
> 
> 
> On 11/7/16, 5:29 PM, "Bob Rudis" <b...@rud.is> wrote:
> 
>> Perhaps https://cran.r-project.org/web/packages/bcrypt/index.html
>> might be of assistance.
>> 
>> If not, drop a note back to the list as it'll be trivial to expand on
>> that to give you an R alternative to Perl.
>> 
>> On Mon, Nov 7, 2016 at 5:47 PM, MacQueen, Don <macque...@llnl.gov> wrote:
>>> I have a file containing encrypted contents. The contents can be
>>> decrypted
>>> using perl, like this:
>>> 
>>> open (FILEHANDLE, "/path/to/file")
>>> chomp ($ciphertext = <FILEHANDLE>);
>>> 
>>> 
>>> use Crypt::CBC;
>>> $cipher = Crypt::CBC->new( -key    => 'my secret key',
>>>                           -cipher => 'Blowfish'
>>>                          );
>>> 
>>> $plaintext  = $cipher->decrypt($ciphertext);
>>> 
>>> 
>>> (See http://search.cpan.org/~lds/Crypt-CBC-2.33/CBC.pm)
>>> 
>>> M goal is to have the value of $plaintext in an R object, so, is there
>>> an
>>> R equivalent to this decrypt() perl function?
>>> 
>>> I've found R packages
>>>  bcrypt
>>>  sodium
>>> that appear to have potential, but I don't understand this business well
>>> enough to figure out how to use them, if indeed they can be used, for
>>> this. Help would be much appreciated.
>>> 
>>> Thanks
>>> -Don
>>> 
>>> --
>>> Don MacQueen
>>> 
>>> Lawrence Livermore National Laboratory
>>> 7000 East Ave., L-627
>>> Livermore, CA 94550
>>> 925-423-1062
>>> 
>>> ______________________________________________
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to