r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

PeterWood
1-Apr-2011
[1219x4]
Yes you would use AES to encrypt the data and then RSA to encrypt 
and send somebody the encryption key.
In my experience, the issues of encrypting in REBOL and decrypting 
in something else usually involve either the chaining method or the 
padding used.
Also, from Wikipedia - AES has a fixed block size of 128 bits whereaas 
Rjindael can have a blocksize in any multiple of 32 between 128 and 
256 bits.
It would seem from the docs at http://www.rebol.com/docs/encryption.html#section-3
that there is no way to specify the block size with Rebol.
GrahamC
1-Apr-2011
[1223]
encrypting something that only rebol can decrypt is not ideal for 
my purposes :(
PeterWood
1-Apr-2011
[1224]
It may well be that REBOL uses a 128-bit block size with Rijndael 
but it isn't clear from the documentation.
GrahamC
1-Apr-2011
[1225]
Has ne1 had any luck unencrypting rebol encrypted stuff?
PeterWood
1-Apr-2011
[1226x2]
If you only need to encrypt data at a single source, you could easily 
call a command line tool such as OpenSSL to perform the encryption 
for you. (It could well be quicker than REBOL too).
I have successfully decrypted something in REBOL that was encrypted 
in JavaScript using RSA.
GrahamC
1-Apr-2011
[1228]
Good to know!
PeterWood
1-Apr-2011
[1229]
If I remember correctly, I was also able to exchange test data that 
was Blowfish encrypted with REBOL but I handled the padding myself:

plain: to binary! text
  
len: remainder length? plain 8

  if 0 < len [

    padding: 8 - len

    insert/dup tail plain to char! padding padding
 
  ]
james_nak
1-Apr-2011
[1230x2]
Again, this might be a Graham question: I'm still working with that 
video encoder which uses http to communicate. They have a .cgi script 
which downloads the recorded video file from the internal SD card 
to the requester. My problem is the content I receive is somehow 
different than the files which I can download via a browser and of 
course will not play. I still using your http-tools to GET/POST. 
My initial thought was that  data returned is somehow being translated. 
Any thoughts?
Perhaps something to do with the http-port-private: open/lines  part. 
If I could open/binary that would be better, no?
GrahamC
1-Apr-2011
[1232]
if there is a binary switch ... it has to occurr after the port is 
opened.
james_nak
2-Apr-2011
[1233]
Thanks. Graham. Good advice. So far I haven't been able to correct 
it but the tip was good.
GrahamC
2-Apr-2011
[1234]
set-modes
james_nak
2-Apr-2011
[1235x2]
Yes, I have it so I read the header info then do set-modes. The data 
still isn't right though.
Got it Graham. I wasn't separating my variable types so there was 
some  unwanted conversion going on. Thanks again for the help.
MikeL
4-Apr-2011
[1237]
I am making a simple (I hope) worfkflow prototype and want to use 
REBOL objects which I can SAVE and LOAD.  A workflow object!  to 
have a node-map collection in it of simple nodes of the workflow 
graph.   Source ->A -> B -> SINK where the workflow knows about the 
next node and status. Externally there is UI to support the work 
part ... which is URL data on a given node.   Looks like it fits 
into Cheyenne RSP well - maybe zmq when I get a bit further along. 
  Save a flow in process as a .txt file using SAVE/ALL filename.txt 
work-flow-instance.   But no success with work-flow-instance: LOAD 
filename.txt        Do I have to BIND on LOAD to re-instantiate the 
object?
GrahamC
4-Apr-2011
[1238]
What do you get when you do a load?
MikeL
4-Apr-2011
[1239x2]
probe load %/c/cheyenne/www/makework/data/wf001.txt
[make object! [
        id: 'wf001
        name: "Add Work"
        node-map: [make object! [
                id: 'SOURCE
                Description: "Add new software for Site"
                status: 'Complete
                Next-Node: 'A
                sub-tasks: "1. Used RFA to enter."
                When-completed: []
                Time: 60
                Notify: none
                status-url: func [] [

                    join http://localhost/makework/status.rsp?id=ID
                ]
                action-url: none
                mark-complete: func [] [
                    Status: 'Complete
                ]
            ] make object! [ ....
The SAVE is a workflow function persist: does [save/all to-file rejoin 
[%data/ id ".txt"] self]
GrahamC
4-Apr-2011
[1241x2]
so looks like you have a block containing an object?
so what happens if you do this

obj: do load wf001.txt ?
MikeL
4-Apr-2011
[1243x2]
They stay as object! definitions viz  obj: do load %data/wf001.txt
>> probe obj
make object! [
    id: 'wf001
    name: "Add Software"
    node-map: [make object! [
            id: 'SOURCE
            Description: "Add new software for Site"
OK I am just doing something stupid and will clear that up soon.
Henrik
11-Apr-2011
[1245]
is there a good way to use mingw with CALL? I need to call git through 
msysgit, while using ssh keys. From what I can find, this looks almost 
impossible.
Ashley
11-Apr-2011
[1246]
OK, this is freaky:

>> system/version
== 2.7.8.2.5
>> a: list-env
== [
    "TERM_PROGRAM" "Apple_Terminal" 
    "TERM" "xterm-color" 
    "SHELL" "/bin/bash" 
    "TMPDIR" "/var/folders/6O/6OnXy9XG...
>> help a
A is a block of value: [
    "TERM_PROGRAM" "Apple_Terminal" 
    "TERM" "xterm-color" 
    "SHELL" "/bin/bash" 

    "TMPDIR" "/var/folders/6O/6OnXy9XGEjiDp3wDqfCJo++++TI/-Tmp-/" 
    "Apple_PubSub_Socket_Render" "/tmp/launch-BrITkG/Render" 
    "TERM_PROGRAM_VERSION" "273.1" 
    "USER" "Ash" 
    "COMMAND_MODE" "legacy" 
    "SSH_AUTH_SOCK" "/tmp/launch-HlnoPI/Listeners" 
    "__CF_USER_TEXT_ENCODING" "0x1F5:0:0" 

    "PATH" {/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin} 
    "PWD" "/Users/Ash" 
    "LANG" "en_AU.UTF-8" 
    "SHLVL" "1" 
    "HOME" "/Users/Ash" 
    "LOGNAME" "Ash" 
    "DISPLAY" "/tmp/launch-U0Gaqw/org.x:0" 
    "_" "/Users/Ash/REBOL/rebol"
]
>> length? a    
== 18
>> select a "USER"
== "Ash"
>> select a "HOME"
== none
GrahamC
12-Apr-2011
[1247]
Have you lost your home?
Sunanda
12-Apr-2011
[1248]
Length? a should be 36 given the above code....
Does this list you all the env variable names?:
    foreach [x y] a [print x]
james_nak
12-Apr-2011
[1249x2]
Same weird behavior here. All the words that print out with Sundanda's 
loop return values all the other's don't.
Actually with my list-env, everything up to PATHEXT works with select 
but apparently nothing after.
GrahamC
12-Apr-2011
[1251]
and what happens if you mold/all it?
BrianH
12-Apr-2011
[1252x3]
Have you tried using SELECT/skip ... 2?
I get the same results on Windows. When I assign a block with the 
same contents to a directly, it all works. It looks like LIST-ENV 
is building a bad block.
No such error in R3, but LIST-ENV returns a map! there, so it wouldn't 
have the same error.
Maxim
18-Apr-2011
[1255]
my discovery of the day:

>> same? rebol system
== true
onetom
19-Apr-2011
[1256]
just stumbled upon it yesterday too :) accidentally. i havent noticed 
that im not in bash and typed rebol
onetom
20-Apr-2011
[1257]
>> map-each e [] [e]
** Throw Error: Return or exit not in function
** Where: map-each
** Near: return any [output make block! 0]


is it a known bug? im new to cure code. i don't even know where to 
look for it. can some one help? (it works in r3)
Dockimbel
20-Apr-2011
[1258]
CureCode: http://curecode.org/rebol3/view-tickets.rsp

Click on "Search" filter type, type "map-each" in input field, then 
hit [Find].
onetom
20-Apr-2011
[1259]
hmm.. that's only for R3. this error is for R2 only.
BrianH
20-Apr-2011
[1260]
Onetom, that error has been reported already and fixed in R2/Forward, 
but it hasn't made it into R2 yet. Here is the revised MAP-EACH:

map-each: func [

 "Evaluates a block for each value(s) in a series and returns them 
 as a block."
	[throw catch]

 'word [word! block!] "Word or block of words to set each time (local)"
	data [block!] "The series to traverse"
	body [block!] "Block to evaluate each time"
	/into "Collect into a given series, rather than a new block"

 output [any-block! any-string!] "The series to output to" ; Not image!
	/local init len x
][
	; Shortcut return for empty data
	either empty? data [any [output make block! 0]] [
		; BIND/copy word and body
		word: either block? word [
			if empty? word [throw make error! [script invalid-arg []]]

   copy/deep word  ; /deep because word is rebound before errors checked
		] [reduce [word]]
		word: use word reduce [word]
		body: bind/copy body first word
		; Build init code
		init: none
		parse word [any [word! | x: set-word! (
			unless init [init: make block! 4]
			; Add [x: at data index] to init, and remove from word
			insert insert insert tail init first x [at data] index? x
			remove x
		) :x | x: skip (

   throw make error! reduce ['script 'expect-set [word! set-word!] type? 
   first x]
		)]]
		len: length? word ; Can be zero now (for advanced code tricks)
		; Create the output series if not specified
		unless into [output: make block! divide length? data max 1 len]
		; Process the data (which is not empty at this point)

  until [ ; Note: output: insert/only output needed for list! output
			set word data  do init

   unless unset? set/any 'x do body [output: insert/only output :x]
			tail? data: skip data len
		]
		; Return the output and clean up memory references
		also either into [output] [head output] (
			set [word data body output init x] none
		)
	]
]
onetom
20-Apr-2011
[1261]
BrianH: thanks, but where can i find such info normally, beside in 
ur brain?
BrianH
20-Apr-2011
[1262]
R3 chat #837 is where the R2/Forward project is normally stored. 
I'll be putting it in github as well as soon as I can figure out 
how to export or replicate the change history.
onetom
20-Apr-2011
[1263]
the change history of what? r3 file storage?
BrianH
20-Apr-2011
[1264x3]
Revisions to R2/Forward since the initial release to DevBase.
There is a similar bug in many of the R3 mezzanine control functions 
(the opposite, actually), but fortunately most of R2's mezzanine 
control functions were converted to native in R3, so the bug doesn't 
affect much.
The revised mezz-series.r (relative to the 2.7.8 SDK source) is in 
R3 chat #8008 - that's the number of the particular version, which 
you can see by going to #41 (R2/Mezzanines) and doing a LF command.
onetom
20-Apr-2011
[1267]
these numbers are like the memory locations in home computers... 
spectrum, c64 (i didn't have an amiga..) in DOS 8000 was the HDD 
bios start, i think..
BrianH
20-Apr-2011
[1268]
The chat interface uses numbers as a deliberate design choice because 
it is easier to memorize and refer to a number than it is to a path 
or message ID. You can even write a message number in #8008 form 
in another message and it can be followed like a hyperlink to the 
message of that number. You can also do the hyperlink trich to CureCode 
tickets using the bug#539 form, which will take you to http://issue.cc/r3/539
(that R3 bug I mentioned above).