Encrypting/Decrypting parameters

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Encrypting/Decrypting parameters

Steffan A. Cline
Has anyone come up with a cool short way to encrypt a map to be passed page
to page?

define encode_params(data::map) =>
encrypt_blowfish(json_serialize(#data),-seed='xxx')->encodehex

define decode_params(data::bytes) =>
json_deserialize(decrypt_blowfish(#data->decodehex,-seed='xxx'))

These work well but produce a really long string. I was hoping for something
much shorter like 10 chars or less.

I'm trying to avoid any kind of service or table holding a unique code type
of translation.

Suggestions?


Thanks,
Steffan

---------------------------------------------------------------
T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline  [hidden email]
http://www.ExecuChoice.net                 Phoenix, Arizona USA
---------------------------------------------------------------




#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Encrypting/Decrypting parameters

Ke Carlton-3
http://goo.gl/4yUhk2 — I suspect you ask for the impossible. 10 characters
pretty much amounts to 10 characters unless you plan on creating a high
level UTF based dictionary or similar.

If your data contains a limited set of keys and values then you can map it
according server side. ie. first character = this key, character values =
a,b,c,... = 'this','that','something else'...

Or you could just use get params.

Ke


On 30 October 2014 13:10, Steffan A. Cline <[hidden email]> wrote:

> Has anyone come up with a cool short way to encrypt a map to be passed page
> to page?
>
> define encode_params(data::map) =>
> encrypt_blowfish(json_serialize(#data),-seed='xxx')->encodehex
>
> define decode_params(data::bytes) =>
> json_deserialize(decrypt_blowfish(#data->decodehex,-seed='xxx'))
>
> These work well but produce a really long string. I was hoping for
> something
> much shorter like 10 chars or less.
>
> I'm trying to avoid any kind of service or table holding a unique code type
> of translation.
>
> Suggestions?
>
>
> Thanks,
> Steffan
>
> ---------------------------------------------------------------
> T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> Steffan A. Cline  [hidden email]
> http://www.ExecuChoice.net                 Phoenix, Arizona USA
> ---------------------------------------------------------------
>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Encrypting/Decrypting parameters

Bil Corry-3
You can't encrypt it that small.  Your choices are:

1. Server-side lookup table
2. Client-side storage of the encrypted text (cookie, HTML5 storage, Flash,
etc)

If the map is a finite set of toggles (e.g. newuser=1, vip=0, etc), you can
use the bit operators to translate the map into an integer.  But even then,
the resulting encrypted text may be very long, depending on the method
chosen.


- Bil


On Thu, Oct 30, 2014 at 4:07 AM, Ke Carlton <[hidden email]> wrote:

> http://goo.gl/4yUhk2 — I suspect you ask for the impossible. 10 characters
> pretty much amounts to 10 characters unless you plan on creating a high
> level UTF based dictionary or similar.
>
> If your data contains a limited set of keys and values then you can map it
> according server side. ie. first character = this key, character values =
> a,b,c,... = 'this','that','something else'...
>
> Or you could just use get params.
>
> Ke
>
>
> On 30 October 2014 13:10, Steffan A. Cline <[hidden email]> wrote:
>
> > Has anyone come up with a cool short way to encrypt a map to be passed
> page
> > to page?
> >
> > define encode_params(data::map) =>
> > encrypt_blowfish(json_serialize(#data),-seed='xxx')->encodehex
> >
> > define decode_params(data::bytes) =>
> > json_deserialize(decrypt_blowfish(#data->decodehex,-seed='xxx'))
> >
> > These work well but produce a really long string. I was hoping for
> > something
> > much shorter like 10 chars or less.
> >
> > I'm trying to avoid any kind of service or table holding a unique code
> type
> > of translation.
> >
> > Suggestions?
> >
> >
> > Thanks,
> > Steffan
> >
> > ---------------------------------------------------------------
> > T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> > Steffan A. Cline  [hidden email]
> > http://www.ExecuChoice.net                 Phoenix, Arizona USA
> > ---------------------------------------------------------------
> >
> >
> >
> >
> > #############################################################
> >
> > This message is sent to you because you are subscribed to
> >   the mailing list Lasso [hidden email]
> > Official list archives available at http://www.lassotalk.com
> > To unsubscribe, E-mail to: <[hidden email]>
> > Send administrative queries to  <[hidden email]>
> >
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Encrypting/Decrypting parameters

Steffan A. Cline
The map was small like map('order_id'=123,'product_id'=456)

The alternative is to use something even shorter like : 123|456 to somehow
generate a shorter string.

Got an example of the bit operator?



Thanks,
Steffan

---------------------------------------------------------------
T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline   [hidden email]
http://www.ExecuChoice.net                 Phoenix, Arizona USA
                 
---------------------------------------------------------------






On 10/31/14, 1:43 AM, "Bil Corry" <[hidden email]> wrote:

>You can't encrypt it that small.  Your choices are:
>
>1. Server-side lookup table
>2. Client-side storage of the encrypted text (cookie, HTML5 storage,
>Flash,
>etc)
>
>If the map is a finite set of toggles (e.g. newuser=1, vip=0, etc), you
>can
>use the bit operators to translate the map into an integer.  But even
>then,
>the resulting encrypted text may be very long, depending on the method
>chosen.
>
>
>- Bil
>
>
>On Thu, Oct 30, 2014 at 4:07 AM, Ke Carlton <[hidden email]> wrote:
>
>> http://goo.gl/4yUhk2 ‹ I suspect you ask for the impossible. 10
>>characters
>> pretty much amounts to 10 characters unless you plan on creating a high
>> level UTF based dictionary or similar.
>>
>> If your data contains a limited set of keys and values then you can map
>>it
>> according server side. ie. first character = this key, character values
>>=
>> a,b,c,... = 'this','that','something else'...
>>
>> Or you could just use get params.
>>
>> Ke
>>
>>
>> On 30 October 2014 13:10, Steffan A. Cline <[hidden email]> wrote:
>>
>> > Has anyone come up with a cool short way to encrypt a map to be passed
>> page
>> > to page?
>> >
>> > define encode_params(data::map) =>
>> > encrypt_blowfish(json_serialize(#data),-seed='xxx')->encodehex
>> >
>> > define decode_params(data::bytes) =>
>> > json_deserialize(decrypt_blowfish(#data->decodehex,-seed='xxx'))
>> >
>> > These work well but produce a really long string. I was hoping for
>> > something
>> > much shorter like 10 chars or less.
>> >
>> > I'm trying to avoid any kind of service or table holding a unique code
>> type
>> > of translation.
>> >
>> > Suggestions?
>> >
>> >
>> > Thanks,
>> > Steffan
>> >
>> > ---------------------------------------------------------------
>> > T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
>> > Steffan A. Cline  [hidden email]
>> > http://www.ExecuChoice.net                 Phoenix, Arizona USA
>> > ---------------------------------------------------------------
>> >
>> >
>> >
>> >
>> > #############################################################
>> >
>> > This message is sent to you because you are subscribed to
>> >   the mailing list Lasso [hidden email]
>> > Official list archives available at http://www.lassotalk.com
>> > To unsubscribe, E-mail to: <[hidden email]>
>> > Send administrative queries to  <[hidden email]>
>> >
>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>>   the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>



#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Encrypting/Decrypting parameters

Bil Corry-3
Your use case won't work for bit-based preferences, but here's how it works
(with more explanation than you probably need, but in case others are
reading along).

Integers are made up of bits in binary notation, e.g.

   0 = 0000
   1 = 0001
   2 = 0010
   3 = 0011
   etc.

Lasso provides access to 64 bits per integer, but because you want only up
to 10 characters, you have access to the first 33 bits (which means you can
track 33 preferences / settings).

The idea is each bit position is a true/false preference, with 0 = false, 1
= true.  The mapping of prefs will look like:

   Pref 1 = position 1
   Pref 2 = position 2
   Pref 3 = position 3
  ...
   Pref 33 = position 33

If you want to set Pref 4 (e.g. to value 1), then you would do this ($prefs
is an integer):

    $prefs->bitset(4);

If you want to clear Pref 4 (e.g. to value 0), then you would do this:

    $prefs->bitclear(4);

If you want to read Pref 4, then you would do this:

    $prefs->bittest(4); // returns TRUE if 1, FALSE if 0

That allows you to compress 33 preferences / settings into a single integer
of up to 10 digits.  If you don't mind having up to 20 digits, you can use
all 64 bits.


- Bil

On Sat, Nov 1, 2014 at 4:20 PM, Steffan A. Cline <[hidden email]> wrote:

> The map was small like map('order_id'=123,'product_id'=456)
>
> The alternative is to use something even shorter like : 123|456 to somehow
> generate a shorter string.
>
> Got an example of the bit operator?
>
>
>
> Thanks,
> Steffan
>
> ---------------------------------------------------------------
> T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> Steffan A. Cline                        [hidden email]
> http://www.ExecuChoice.net                 Phoenix, Arizona USA
>
> ---------------------------------------------------------------
>
>
>
>
>
>
> On 10/31/14, 1:43 AM, "Bil Corry" <[hidden email]> wrote:
>
> >You can't encrypt it that small.  Your choices are:
> >
> >1. Server-side lookup table
> >2. Client-side storage of the encrypted text (cookie, HTML5 storage,
> >Flash,
> >etc)
> >
> >If the map is a finite set of toggles (e.g. newuser=1, vip=0, etc), you
> >can
> >use the bit operators to translate the map into an integer.  But even
> >then,
> >the resulting encrypted text may be very long, depending on the method
> >chosen.
> >
> >
> >- Bil
> >
> >
> >On Thu, Oct 30, 2014 at 4:07 AM, Ke Carlton <[hidden email]> wrote:
> >
> >> http://goo.gl/4yUhk2 ‹ I suspect you ask for the impossible. 10
> >>characters
> >> pretty much amounts to 10 characters unless you plan on creating a high
> >> level UTF based dictionary or similar.
> >>
> >> If your data contains a limited set of keys and values then you can map
> >>it
> >> according server side. ie. first character = this key, character values
> >>=
> >> a,b,c,... = 'this','that','something else'...
> >>
> >> Or you could just use get params.
> >>
> >> Ke
> >>
> >>
> >> On 30 October 2014 13:10, Steffan A. Cline <[hidden email]> wrote:
> >>
> >> > Has anyone come up with a cool short way to encrypt a map to be passed
> >> page
> >> > to page?
> >> >
> >> > define encode_params(data::map) =>
> >> > encrypt_blowfish(json_serialize(#data),-seed='xxx')->encodehex
> >> >
> >> > define decode_params(data::bytes) =>
> >> > json_deserialize(decrypt_blowfish(#data->decodehex,-seed='xxx'))
> >> >
> >> > These work well but produce a really long string. I was hoping for
> >> > something
> >> > much shorter like 10 chars or less.
> >> >
> >> > I'm trying to avoid any kind of service or table holding a unique code
> >> type
> >> > of translation.
> >> >
> >> > Suggestions?
> >> >
> >> >
> >> > Thanks,
> >> > Steffan
> >> >
> >> > ---------------------------------------------------------------
> >> > T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> >> > Steffan A. Cline  [hidden email]
> >> > http://www.ExecuChoice.net                 Phoenix, Arizona USA
> >> > ---------------------------------------------------------------
> >> >
> >> >
> >> >
> >> >
> >> > #############################################################
> >> >
> >> > This message is sent to you because you are subscribed to
> >> >   the mailing list Lasso [hidden email]
> >> > Official list archives available at http://www.lassotalk.com
> >> > To unsubscribe, E-mail to: <[hidden email]>
> >> > Send administrative queries to  <[hidden email]>
> >> >
> >>
> >> #############################################################
> >>
> >> This message is sent to you because you are subscribed to
> >>   the mailing list Lasso [hidden email]
> >> Official list archives available at http://www.lassotalk.com
> >> To unsubscribe, E-mail to: <[hidden email]>
> >> Send administrative queries to  <[hidden email]>
> >>
> >
> >#############################################################
> >
> >This message is sent to you because you are subscribed to
> >  the mailing list Lasso [hidden email]
> >Official list archives available at http://www.lassotalk.com
> >To unsubscribe, E-mail to: <[hidden email]>
> >Send administrative queries to  <[hidden email]>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>