How to encrypt with App Inventor

3,185 views
Skip to first unread message

Taifun

unread,
Aug 6, 2012, 2:28:54 PM8/6/12
to ai...@googlegroups.com
The App Inventor - HMAC-SHA1 encryption example can be found here: http://puravidaapps.com/encrypt.php
Issue 244 and Issue 553 are no issues anymore!

Taifun
puravidaapps.com

Gary

unread,
Aug 6, 2012, 2:45:23 PM8/6/12
to ai...@googlegroups.com
I love it when someone takes an idea and runs with it! More good work by Taifun the wizard!!!


One of the things I like about App Inventor is it is easy to do thing.
Another is there are various ways to do them.

I am working on an app that does base64url. It is part of what KC and I are working on. You pick a file from the phone and it returns a base64url buffer. His app then send the buffer to Google Cloud Storage where it is converted back to the image.

The app is an Android app that works with App Inventor using Activity Starter.

The example I am going to release uses fusion tables to hold the images. This will demonstrate how you can store images (as base64url) in the cloud and load and store them with App Inventor.

Taifun's example eliminates the need for another app. Perfect for testing or if using html is good enough for your use using the code.

My app shows how to do that sort of thing and is a step in the direction of putting it into App Inventor as native code.

What else can we do?

Gary

Gary

unread,
Aug 6, 2012, 2:50:33 PM8/6/12
to ai...@googlegroups.com
Taifun

How is the library of useful html5/javascript that can be used in App Inventor coming?

:-) :-) :-)

Gary


Not quite our situation but I like the idea

and

Eeyore is my favorite character
'Thanks for noticing' :-)

Taifun

unread,
Aug 6, 2012, 3:07:03 PM8/6/12
to ai...@googlegroups.com
I love it when someone takes an idea and runs with it! More good work by Taifun the wizard!!!
thank you...


What else can we do?

How is the library of useful html5/javascript that can be used in App Inventor coming?
yes,  lots of possibilities :-)
did not understand that... 80. birthday?
just googled Eeyore...
He is generally characterized as a pessimistic, gloomy, depressed, anhedonic, old grey stuffed donkey who is a friend of the title character, Winnie-the-Pooh
but you are not pessimistic, are you?
 
Taifun

Anthony Barnes

unread,
Aug 6, 2012, 3:38:30 PM8/6/12
to ai...@googlegroups.com
Gee, that does sound like Gary!  LOL!
--

tribblehunter

unread,
Aug 6, 2012, 3:40:29 PM8/6/12
to ai...@googlegroups.com
Ok.... Noob question from a semi-noob who is getting overloaded with all these new toys!!

I am using shival wolfs webmail2 to email from app via app engine.

It uses https. Is this the same as encryption? Is my data being sent from app inventor app to google apps un-encrypted at the moment, only getting encrypted at google app engine?

As stated, still a noob in lots of this. Lol.

Tribblehunter

tribblehunter

unread,
Aug 6, 2012, 3:41:40 PM8/6/12
to ai...@googlegroups.com


Oh- forgot to add.....

Excellent development Gary and Taifun...

And...

Woo Hoo!!

Taifun

unread,
Aug 6, 2012, 3:53:17 PM8/6/12
to ai...@googlegroups.com

tribblehunter

unread,
Aug 6, 2012, 4:06:27 PM8/6/12
to ai...@googlegroups.com
Thank you Taifun.

I nominate you for the title App Inventor Guru, along with Gary, Tony and Scott. Lol.

Tribblehunter

Gary

unread,
Aug 6, 2012, 4:58:54 PM8/6/12
to ai...@googlegroups.com

On Monday, August 6, 2012 2:07:03 PM UTC-5, Taifun wrote:
I love it when someone takes an idea and runs with it! More good work by Taifun the wizard!!!
thank you...

What else can we do?

How would we use html/javascript to do services?

and does issue 32 want to start a service or have App Inventor respond to broadcasts or what???

 


How is the library of useful html5/javascript that can be used in App Inventor coming?
yes,  lots of possibilities :-)


and we can ALL get in
I felt that Pooh should have let Owl share in giving the gift.

 
just googled Eeyore...
He is generally characterized as a pessimistic, gloomy, depressed, anhedonic, old grey stuffed donkey who is a friend of the title character, Winnie-the-Pooh
but you are not pessimistic, are you?

No, I guess not
sigh

Eeyore is NOT anhedonic

 
 
Taifun

Taifun

unread,
Aug 6, 2012, 5:14:21 PM8/6/12
to ai...@googlegroups.com
What else can we do?

How would we use html/javascript to do services?
and does issue 32 want to start a service or have App Inventor respond to broadcasts or what???


no, :-)
I understood that question in general and not only HTML/JavaScript specific...
waiting for App Inventor to be able to run in the background...
Taifun

Scott Ferguson

unread,
Aug 6, 2012, 6:30:36 PM8/6/12
to ai...@googlegroups.com
That was the old Gary. He is now feeling inspired! (and maybe a little bit more appreciated :)
---

kc ochibili

unread,
Aug 7, 2012, 6:04:07 PM8/7/12
to ai...@googlegroups.com
Hey Taifun, 
  I was studying your encoding using html http://puravidaapps.com/encrypt.php so I was wondering if it is possible to do the same with images in AI (images from canvas) 
I have been working on a project that posts image to the cloud and the image needs to be base 64 encoded. 
In a nutshell, is it possible to encode and decode images to base64 and be able to get the bytes in the file ?

Taifun

unread,
Aug 7, 2012, 9:32:30 PM8/7/12
to ai...@googlegroups.com
Hi,
I think this is possible with images you uploaded as assets into AI, probably also with images stored on SD card, but this needs to be tested....
Probably we need access to the file system?
Probably possible with the file api, Gary mentioned? https://groups.google.com/d/msg/ai4a/5GdXhIjOQvk/xO3Pab2Hf7sJ
currently I use the title of the html document as out parameter from the embedded html/javascript, I currently do not know if there is a length limit..
Taifun

Scott Ferguson

unread,
Aug 7, 2012, 10:16:01 PM8/7/12
to ai...@googlegroups.com
@Taifun
With the ability to save and load a file from AI and if a file contains either CSV or JSON text we could likely transfer complex data structures of virtually unlimited size via the local file system. And those data structures could be created by either Javascript (CSV, JSON, ?) or AI (CSV, JSON).
---

Taifun

unread,
Aug 8, 2012, 8:27:45 AM8/8/12
to ai...@googlegroups.com
there is a difference what AI can do and what the embedded HTML/Javascript can do...
Taifun

Taifun

unread,
Aug 8, 2012, 8:50:14 AM8/8/12
to ai...@googlegroups.com

attached a HTML/Javascript file for KC's base64 conversion of an image.
it works in the browser, but currently not together with AI... we have to find out, why...
the example needs as parameter the path to an image file, e.g. you type in the browser the following (assuming the html file is in directory C:/DATEN/AppInventor/base64/base64.html and in the same directory is an image icon.png)
file:///C:/DATEN/AppInventor/base64/base64.html?icon.png

Taifun
puravidaapps.com


base64.html

kc ochibili

unread,
Aug 9, 2012, 1:09:29 AM8/9/12
to ai...@googlegroups.com
Thanks for the example, I was able to direct an image to it both on the browser and on the phone but the conversion only worked in my windows browser.
Two hings I think might help diagnosis this issue
--To test it on androids default browser and
 can you include a button that does the conversion when clicked?
Message has been deleted

Scott Ferguson

unread,
Aug 9, 2012, 11:21:33 AM8/9/12
to ai...@googlegroups.com
I get 'HTML canvas not supported.'  when viewing the source of the html in Firefox 14.0.1 - maybe same issue with WebViewer?
---


On Wednesday, August 8, 2012 7:50:14 AM UTC-5, Taifun wrote:

kc ochibili

unread,
Aug 9, 2012, 11:36:28 AM8/9/12
to ai...@googlegroups.com
@Scott, it works for me in Google chrome, it also worked for taifun in firefox, 
here is what you can do; open Google chrome, come to this page where Taifun attached the file then click view

Rifky Mercon

unread,
Jan 5, 2013, 7:05:51 AM1/5/13
to ai...@googlegroups.com
Hi, is possible to encrypt and decrypt text/message using app inventor, using any algorithm?

Gary

unread,
Jan 5, 2013, 8:46:43 AM1/5/13
to ai...@googlegroups.com
Howdy Rifky

Taifun gave examples that use javascript. If that does not work,
KC and I came up with an example 

"I am working on an app that does base64url. It is part of what KC and I are working on. You pick a file from the phone and it returns a base64url buffer. His app then send the buffer to Google Cloud Storage where it is converted back to the image."

I built an example that does the base64uerl encoding and added it to a version of asUtil https://play.google.com/store/apps/details?id=com.jsoft.android.as (base64url is not in the Google Play version, but it could be :-))

however

Hal in a discussion about running as a service in a MIT group mentions that "we want to keep App Inventor simple" . Adding blocks that encrypt/decrypt would sorta make App Inventor less simple. However, we can use Activity Starter or javascript to get the less simple stuff into App Inventor. Here is some conversation about Activity Starter

I added base64url encoding to the asUtil app. Then I tested with an App Inventor app. Then I took the code that did base64url encoding and added it to an Android app and also added the code from the App Inventor app. That gave me an app that added base64url encoding to App Inventor.

Sooooo

You have choices. You can try to implement the algorithm in your code or you can use Taifun's javascript or you can use my Activity Starter idea.

Not easy but you can get it done
AND if you document then the next person has it a lot easier :-)

Gary

Taifun

unread,
Jan 5, 2013, 9:40:37 AM1/5/13
to ai...@googlegroups.com
Hi, is possible to encrypt and decrypt text/message using app inventor, using any algorithm?
yes, in case the algorithm is available in JavaScript you can do it according to my example http://puravidaapps.com/encrypt.php
Taifun
puravidaapps.com

Rifky Mercon

unread,
Jan 6, 2013, 2:25:17 AM1/6/13
to ai...@googlegroups.com
Hi
Thank you for the reply
I've tried base64 taifun that using HMAC-SH1, but it seems that 'one way hash' can not decrypt

It's quite difficult for me to make the algorithms for text encryption and decryption, because some algorithms and the time that I use seems to be useful for files, but not for text, there may be other algorithm than using a hash, please help me

thanks

Rifky Mercon

unread,
Jan 6, 2013, 2:27:25 AM1/6/13
to ai...@googlegroups.com
Hi taifun
can you make it for other algorithms, because... I think one way hash can't decrypted
thanks

Jose Mª Martin

unread,
Jan 6, 2013, 5:26:55 AM1/6/13
to ai...@googlegroups.com

You can do encryption and decryption algorithms using math, just create the mathematical structure.

You can find one that suits your needs and create directly in the block editor.

Another option is to make leaning in mysql, encrypting what you need in the DB and collecting values ​​when needed, but it requires internet connection.

Taifun

unread,
Jan 6, 2013, 9:34:22 AM1/6/13
to ai...@googlegroups.com
did you already do a Google search for an encrypt/decrypt algorithm which is available as JavaScript library you like to use?
Taifun

Jose Mª Martin

unread,
Jan 6, 2013, 11:14:18 AM1/6/13
to ai...@googlegroups.com


With Js I have not done it, I have sought a method of encryption in wikipedia and I used your formula in AppInventor to encrypt and decrypt, then the mathematics that brings've developed within the block editor.

But surely Js are adapted various methods, another way is to ask the field mysql this encryption, and the database will do all the work, you just would have to send requests to insert or fetch data.

Rifky Mercon

unread,
Jan 6, 2013, 11:44:55 AM1/6/13
to ai...@googlegroups.com
I've tried using eclipse, I have adopted from the vb algorithm, not too difficult, but using a block like a new challenge, I have much to learn.

I am always googling even up to 10 pages, but it seems not many AI references

Taifun

unread,
Jan 6, 2013, 4:06:24 PM1/6/13
to ai...@googlegroups.com
I am always googling even up to 10 pages, but it seems not many AI references
you will not find much App Inventor examples which use encryption...
but you can use any JavaScript library with App Inventor, the examples how to do access them you will find on my webpage http://puravidaapps.com/snippets.php
Taifun

Taifun

unread,
Jan 7, 2013, 4:51:30 PM1/7/13
to ai...@googlegroups.com
in the App Inventor Gallery you also can find a project which uses the basic ideas of my example http://gallery.appinventor.mit.edu/#page%3DApp%26uid%3D121015%26label%3DCryptoDB
Taifun

Rifky Mercon

unread,
Jan 12, 2013, 12:01:34 AM1/12/13
to ai...@googlegroups.com
I'm trying a new method as written here
whether it could use a snippet from you, do you know that writing format?
Rifky

Taifun

unread,
Jan 12, 2013, 5:14:05 PM1/12/13
to ai...@googlegroups.com
yes, you could use the same technique as I used in the JavaScript examples
Taifun

Rifky Mercon

unread,
Jan 17, 2013, 12:10:15 AM1/17/13
to ai...@googlegroups.com
yeah, I', try it for a few days and i can't make it to work, maybe I must try another algorithms
Thanks
Rifky

Scott Ferguson

unread,
Jan 17, 2013, 10:00:45 AM1/17/13
to ai...@googlegroups.com
While it is possible to roll-your-own encryption and decryption algorithms for text with AI as I did HERE, being able to do this for binary data within AI is questionable. I am not certain that all values can be handled with the character set. Let us know if you have a solution which does support binary data, anyone.
---sfs

Gary

unread,
Jan 17, 2013, 10:09:46 AM1/17/13
to ai...@googlegroups.com
I did an activity starter that gave back base64url that you could encrypt.

Is it worth following up?

Gary

Scott Ferguson

unread,
Jan 17, 2013, 10:23:21 PM1/17/13
to ai...@googlegroups.com
Thanks, Gary. I hope someone can use that method.
---sfs

hallelu...@gmail.com

unread,
Feb 9, 2015, 2:58:53 PM2/9/15
to ai...@googlegroups.com
hi,can you please tell me if i should modify both src in 
<script src="hmac-sha1.js"></script>
  <script src="enc-base64-min.js"></script>
with the real emplacement ? 
if i do,that the file containing hmac-shA1 and the one containing enc-base64-min ,in one file containing encrypt.html too ? 
ps: i coudn"t find the assests file mentionned in the code blocks

Thank you 

Taifun

unread,
Feb 9, 2015, 3:04:31 PM2/9/15
to ai...@googlegroups.com
you can find the 2 libraries in the media section of the designer
Taifun


hallelu...@gmail.com

unread,
Feb 9, 2015, 3:27:18 PM2/9/15
to ai...@googlegroups.com
Ah , thank you so much
but i've downloaded the whole file encrypt.aia as a new project ,and after testing it on the emulator ,i result textbox stays empty , can you tell me if there is a modification that i should make ? 

Taifun

unread,
Feb 9, 2015, 4:12:34 PM2/9/15
to ai...@googlegroups.com
use version 2 of the example which is available for download in the download section here

hallelu...@gmail.com

unread,
Feb 10, 2015, 7:57:56 AM2/10/15
to ai...@googlegroups.com
ok,thank you for your responses,i'm new at this, so i guess its normal that i dont have and sdcard/assets file on my computer , and i'm using an emulator not a phone 

Taifun

unread,
Feb 10, 2015, 1:01:46 PM2/10/15
to ai...@googlegroups.com
yes, that doesn't matter
Taifun

Reply all
Reply to author
Forward
0 new messages