Starting with android

Introduction to android development

Developing android apps is pretty cool don't you think? today we will start learning how to start developing our own android apps from scratch. but you have to "walk before you can run", so let's start from the beginning.

Android is an mobile operating system based on linux kernel, developed by google... info just in case you did not know. So, if you want to build android apps, then you have to be familiar the with the official site for android developers. There you can find more detailed information.


Well, let's get this more seriously. There are two types of android application:

  • Native application 
  • Hybrid application
They both have some advantages and i'll quickly name some of them.

Native applications get better performace since they're comunicate directly with the "core", the system can "understand" it's behavior. but they take too many time and effort to be done they use to be written in java.

Hybrid applications are cheaper in terms of time and effort, the can be developed using those languages and technologies you may be familiar with in web development (Html, Javascript, Css, Jquery...) and packed into an android executable file with Phonegap. But they run on the webkit browser engine to accomplish anything, basically, it runs on a browser. therefore they become slower.

We will then download "eclipse" ADT (Android Developer Tools) so we can start building native apps. You can also use Android studio ("will be the official Android IDE once it's ready").



That package is already full with the tools you need (including an android OS image). now you just need to install/update java. and we're ready to start, stay tuned for the next part when we start getting familiar with the ADT.

Thank you for reading

(I apologize for anything that can be wrong or out of date, if you see some errors or want me to write about something I'm missing, please comment below)

SHA1 hash in c#

Hi, let’s try to get the SHA1 hash from a string in .NET c#.

SHA1 hash is often used to “encrypt” passwords, but notice it’s not the way you’re going to be totally secured, there are many other ways to store way more secure passwords, for any reason you’re trying to calculate a string’s sha1 hash, this is the right place, let’s do it the easy way.

I’m actually using Microsoft Visual Studio 2010 Ultimate with .NET Framework V 4.0 but I guess it will work in any other version.

First you need to create a “Windows Forms Application” project  (File > New > Project > Windows Forms Application). Give it the name you want and hit ok.



Now we’re ready to start, drag a “Button” and a “TextBox” from the left side and drop them into the “Form” like this:



Set the TextBox’s name property to “txtString” or whatever you want.




Now set the button’s text to something like: “Hash”. Then double click the Button, you will see some code like:

       private void Button1_Click(object sender, EventArgs e)
              {


              }

There we will place our “really hard” code inside those curly braces. Meanwhile, go to the top and place a new “Using” directive:

       using System.Security.Cryptography;

That will allow us to achieve the sha1 hash and some others. Now going back to our “Click” event, let’s get the text that has been typed into the TextBox and store it inside “myString” variable (remember you can name it what you want):

      string myString = txtPass.Text;
      //save our text
      byte[] otherString = Encoding.Unicode.GetBytes(myString);
      SHA1 string2 = SHA1.Create();
      //instantiate sha1
      otherString = cadena2.ComputeHash(otherString);
      //get the hash
      string base64 = Convert.ToBase64String(otherString);
      //convert it to “base64”
      txtString.Text = base64;

Then we’ve set the “txtString” text to the hash so we can see it when it’s done. Now press “F5” and see the “magic”.



That’s all, thank you for reading.