the simple workaround is write it to a file, load, then erase the file.

require 'format/printf'
lockedV =: 2 : 0
a =. m sprintf boxopen n
(3!:6 ] a) 1!:2 fl =. < jpath '~temp\filet.ijl'
0!:0 fl
1!:55 fl
)

HashSalter =: 'SaltedHash_hashes_ =: ''sha256'' gethash ''%j'' , ]' lockedV

The above does something fancier than that.  lockedV uses a template, and binds 
another parameter to it.

HashSalter is an adverb (template bound to conjunction), and the locked verb 
result (SaltedHash_hashes_) when bound with a parameter is a secret hash 
function.




----- Original Message -----
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Thursday, October 22, 2015 7:01 PM
Subject: Re: [Jprogramming] Executing Locked Scripts from Nouns

I guess I didn't go looking for the locked script support.

Of course, you could also implement something in user space.

For example:

   ode=: (&.((8#2)&#:))(&.(a.&i.))
   enc=: (_8 ]\[)@,@|:ode
   dec=: |:@($~ 8,#%8:)@,ode

   enc dec 'sum=:+/'
sum=:+/

More elaborate possibilities exist, and of course anyone with access
to the machine and a basic understanding of machine language can just
grab the decoded memory image without bothering to figure out how the
algorithm works.

Thanks,

-- 
Raul

On Thu, Oct 22, 2015 at 4:42 PM, Eric Iverson <[email protected]> wrote:
> I suggest reading the file when you have access and then using a temp
> file later on when you need to load it. This is an adequate workaround
> to what has always been a kludgey area.
>
> It is unlikely that Jsoftware has interest in 'bug fixes' in this
> particular area.
>
> We will likely, by year end, do a new official GPL release of J that
> will be intended for broader use (and feedback to us). One change we
> will make is that we will distribute the source file that implements
> our official release lock/unlock mechanism.
>
> This change will be accompanied by doc changes that state that locked
> files are not very secure (never were and will be even less so).
> Locking a file is an indication that the J source in the file is
> proprietary and that nice users will respect that and not pry. And
> nasty users are just nasty.
>
>
> On Thu, Oct 22, 2015 at 12:40 PM, Thomas Costigliola <[email protected]> 
> wrote:
>> Attempting to run a locked script from a noun doesn't work:
>>
>> 0!:1]3!:6 'sum=:+/'
>>
>> �
>>
>> |spelling error
>>
>> | �
>>
>>
>> I understand there might not have been an apparent use case for this, but
>> is there a technical or security reason for the restriction?
>>
>>
>> I need to read the contents of a locked script into a noun but not execute
>> it until a later time at which the file will no longer be accessible. This
>> seems easy to implement in the interpreter, but I was wondering if there
>> was something I am overlooking that makes it difficult or undesirable.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm

> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to