Actionscript one way encryption - actionscript

Is there a built in method in Actionscript 3 that allows you to create a hash of a string. Like MD5 and SHA1.
Thanks.

First link on google for "Actionscript3 md5"
http://gsolofp.blogspot.com/2006/01/actionscript-3-md5-and-sha1.html
As such, it looks like there is no built-in method.

There is no builtin method for doing crypto things, but there exists some library that can be used:
http://code.google.com/p/as3crypto/
http://code.google.com/p/as3corelib/

Related

Grails Override reserved work in a controller?

I am currently working on a Grails solution and I am looking to pass a URL using WSLite, I basically want to pass a bunch of query params and have them fired off. One of the params I need to have is session.name, I need this exactly like this as a 3rd party system can only read data as "session.WHATEVER". However when i enter the data below it has a problem with the "session." as it appears that session is a reserved word in grails. Is there anyway I can get grails not to pick-up the reserved word and just use session.name? Maybe by some sort of override?
def response = client.get(path:'/TestingService', query:[code:testCode, session.name: name])
Thanks
Use quotes:
query:[code:testCode, 'session.name': name]

Can file reading callback function be customized in cURL?

I want to upload a file with cURL. Instead of an existing file on the hard disk, it is in memory(yes, I compose the file at runtime and want to eliminate the temporary file).
IIRC, with cURL, we can customize read callback function when sending ordinary post data. So is there similar mechanism we can use to customize callback function when reading a file, especially when used accompanied with multipart post?
Thanks and Best Regards!
Yes, curl_formadd's CURLFORM_STREAM is your friend:
Tells libcurl to use the CURLOPT_READFUNCTION callback to get data.
The parameter you pass to CURLFORM_STREAM is the pointer passed on to
the read callback's fourth argument. If you want the part to look like
a file upload one, set the CURLFORM_FILENAME parameter as well. Note
that when using CURLFORM_STREAM, CURLFORM_CONTENTSLENGTH must also be
set with the total expected length of the part. (Option added in
libcurl 7.18.2)

POST data in Lua

I'm learning Lua at the moment. I need to be able to access post and get data. I'm trying to find out how the equivalent of PHP $_POST and $_GET in Lua.
This depends on the web server you are running in, and any intermediary libraries you are using.
In Apache 2.3, using the included mod_lua, it would be
function my_handler(r)
-- URI params
local simple, full = r:parseargs()
-- POST body
local simple, full = r:parsebody()
end
Where simple is a table of key -> value (what you want most of the time) and full is key -> [value1, value2, ...] for cases of duplicately named params.
Fuller examples are available at http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/test/htdocs/test.lua?revision=728494&view=markup
There are many web-frameworks for Lua, each with its own way of accessing GET and POST.
Probably easiest way to learn Lua for the web-development is to use WSAPI.
To get GET and POST, use wsapi.request in your handler:
require 'wsapi.request'
local handler = function(env)
local request = wsapi.request.new(env)
local GET = wsapi.request.GET
local POST = wsapi.request.POST
...
end
There is no equivalent as Lua is not designed as a web scripting language. In what context are you using this (CGI, FCGI, Apache module)? You'll probably need to look into the CGI specification and accessing environment variables and stdin from Lua.
You could always check out Lua4Web https://github.com/schme16/Lua4Web
Reading POST data in traditional html-form or url-encoded format is a mess in Lua. Better you try to use AJAX forms javascript library, so you get your data sent in JSON back to the server where you can easily parse and use.

sha256 encryption in erlang

i have written some code in php there i have use mhash(MHASH_SHA256, $key) and its giving result as expected.i wanna know how we can achieve same thing in erlang.i can see in crypto their is one inbuild sha function is their but i dont think so its mean for sha256.
any suggestion what i have to do ?
thank you in advance.
Have you seen this page, which links to an SHA-256 module for Erlang?
EDIT: Apparently that code is obsolete, replaced by this module. If that still doesn't do what you want (in terms of hex/binary) I suggest you email its author, preferably with a patch.
It seems to me that the return value of the mentioned sha2 module depends on your input. If you call it with a binary, the result is binary; if you call it with a string, the result is a string:
sha2:hexdigest256("Zed").
"a90e4dc685583c72296ca49b5d0bb148f2e1197a805b2a1d2ff6d17b4398b2be"
sha2:hexdigest256(<<"Zed">>).
<<169,14,77,198,133,88,60,114,41,108,164,155,93,11,177,72,
242,225,25,122,128,91,42,29,47,246,209,123,67,...>>

How to pass parameters between rails applications?

I have to pass parameters between two rails apps. In one side (sender) I have an array of hashes. I have a code like the following to send the data:
http = Net::HTTP.new('localhost', '3030')
result = http.post('/processar_lotes', my_array_of_hashes)
Some questions
Is there any (kind of) serialize or something like this that I can pass to the other app?
At the other side, how can I de-serialize the information?
Is there a limit to the size of what I pass as a parameter?
To answer your questions:
There are many ways to 'serialize' the data. You can use your own custom format, or use a standard one. For example, you can try to use the Rails to_xml method, or the to_json method. You can also use Ruby's Marshal object.
Depending on your choice, this might be from_json, from_xml, Marshal.load, or your own custom reader.
Normally, this is unlimited for HTTP posts, but depending on your server configuration, it could be less.
Probably not the answer you're looking for, but I'd use XML. This would make your application much more flexible than using language-specific serialization.
It shouldn't be too hard to convert the array to XML and back.
EDIT: You might wanna check out ROXML and XML::Mapping.

Resources