Encrypt and Decrypt – Basic version
This is a basic version of encrypt-decrypt function…we used this from one of the .NET sites, since i am not able to find teh reference link , iam posting it here so that others can use it…
public class MyEnctDect
{
private Byte[] key = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 };
private Byte[] iv = { 65, 110, 68, 26, 69, 178, 200, 219 };
public string Encrypt(string plainText)
{
//’ Declare a UTF8Encoding object so we may use the GetByte
//’ method to transform the plainText into a Byte array.
String outString;
UTF8Encoding utf8encoder = new UTF8Encoding();
Byte[] inputInBytes = utf8encoder.GetBytes(plainText);
//’ Create a new TripleDES service provider
TripleDESCryptoServiceProvider tdesProvider = new TripleDESCryptoServiceProvider();
//’ The ICryptTransform interface uses the TripleDES
//’ crypt provider along with encryption key and init vector
//’ information
ICryptoTransform cryptoTransform = tdesProvider.CreateEncryptor(key, iv);
//’ All cryptographic functions need a stream to output the
//’ encrypted information. Here we declare a memory stream
//’ for this purpose.
MemoryStream encryptedStream = new MemoryStream();
CryptoStream cryptStream = new CryptoStream(encryptedStream, cryptoTransform, CryptoStreamMode.Write);
//’ Write the encrypted information to the stream. Flush the information
//’ when done to ensure everything is out of the buffer.
cryptStream.Write(inputInBytes, 0, inputInBytes.Length);
cryptStream.FlushFinalBlock();
encryptedStream.Position = 0;
//’ Read the stream back into a Byte array and return it to the calling
//’ method.
// Dim result(encryptedStream.Length – 1) As Byte
byte[] result = new byte[encryptedStream.Length];
encryptedStream.Read(result, 0, (int)encryptedStream.Length);
cryptStream.Close();
//’test section
//’Convert to / fro the memory stream to a base64 string
//’compare decText to result
outString = System.Text.ASCIIEncoding.Default.GetString(result);
string encText = Convert.ToBase64String(encryptedStream.ToArray());
byte[] decText = Convert.FromBase64String(encText);
string sDec = Decrypt(decText);
return outString;
}
public String Decrypt(Byte[] inputInBytes)
{
//’ UTFEncoding is used to transform the decrypted Byte Array
//’ information back into a string.
UTF8Encoding utf8encoder = new UTF8Encoding();
TripleDESCryptoServiceProvider tdesProvider = new TripleDESCryptoServiceProvider();
//’ As before we must provide the encryption/decryption key along with
//’ the init vector.
ICryptoTransform cryptoTransform = tdesProvider.CreateDecryptor(key, iv);
//’ Provide a memory stream to decrypt information into
MemoryStream decryptedStream = new MemoryStream();
CryptoStream cryptStream = new CryptoStream(decryptedStream, cryptoTransform, CryptoStreamMode.Write);
cryptStream.Write(inputInBytes, 0, inputInBytes.Length);
cryptStream.FlushFinalBlock();
decryptedStream.Position = 0;
//’ Read the memory stream and convert it back into a string
Byte[] result = new byte[decryptedStream.Length];
decryptedStream.Read(result, 0, (int)decryptedStream.Length);
cryptStream.Close();
UTF8Encoding myutf = new UTF8Encoding();
return myutf.GetString(result);
}
}
usage
MyEnctDect classDeclartion = new MyEnctDect();
classDeclartion.Encrypt(text);
classDeclartion.Decrypt(bytearray);
Its a good one for beginners, there are other methods available as well
Creating controls with javascript
Thought this will be helpful for beginners
Create static combo
Create password field
create textbox
create textarea, all samples are subject to COPY rights…i mean you can use them for freee…
function CreateStaticCombo(sCtrlId, Width, list, value, defaultValue) {
var optGroup = document.createElement(’select’)
var arr = list.split(‘###’);
optGroup.setAttribute(‘className’, ‘ComboBoxStyle’);
optGroup.onblur = function() { };
optGroup.id = sCtrlId;
optGroup.name = sCtrlId;
var objOption = document.createElement(“option”)
objOption.innerText = “”;
objOption.value = “”;
optGroup.appendChild(objOption)
for (var i = 0; i < arr.length; i++) {
if (arr[i] != "") {
var objOption = document.createElement("option")
objOption.innerText = arr[i];
objOption.value = arr[i];
if (arr[i] == value.trim())
objOption.selected = true;
optGroup.appendChild(objOption)
}
}
optGroup.style.border = 0;
optGroup.onkeyup = function() { };
return optGroup;
}
function CreateLookupIcon(sCtrlId, IsLookupConditionAvailable) {
var imageNode = document.createElement("input");
imageNode.type = 'image';
imageNode.id = "imagetext"
imageNode.src = '../images/asmall.gif';
imageNode.onclick = function() { someJavascriptFunction(someParameters); return false; };
return imageNode;
}
function CreateHiddenField(sCtrlId) {
var txtbox = document.createElement('input');
txtbox.type = 'hidden';
txtbox.id = sCtrlId.replace('TD', 'D');
txtbox.name = sCtrlId.replace('TD', 'D');
return txtbox;
}
function CreatePassword(sCtrlId) {
var txtbox = document.createElement('input');
txtbox.onblur = function() { SetHiddenValue(this.id, this.value); EvaluateExpression('ALL', sCtrlId.toString().split('~')[2]) };
txtbox.type = 'password';
txtbox.passwordText = '*';
txtbox.id = sCtrlId;
txtbox.name = sCtrlId;
txtbox.setAttribute('className', 'MVTextBoxStyle');
txtbox.style.border = 1;
txtbox.style.bordercolor = "black";
txtbox.style.borderStyle = "solid"
return txtbox;
}
function CreateTextArea(sCtrlId, Width) {
var txtbox = document.createElement('textarea');
txtbox.rows = "2";
txtbox.style.height = "40px";
txtbox.onblur = function() { SetHiddenValue(this.id.replace('txt', ''), this.value); EvaluateExpression('ALL', sCtrlId.toString().split('~')[2]) };
txtbox.id = "txt" + sCtrlId;
txtbox.name = "txt" + sCtrlId;
txtbox.setAttribute('className', 'MVTextBoxStyle');
return txtbox;
}
Fruits, Flowers and Sea !!!
Camera Version – Canon – i have replaced my earlier pic with this new one

Fruits

Seashore

one of my earlier sketches
This one is my favorite

Some of my random sketches
All sketches were done with Stedler pencils….
Bridge

Far Far Away !!!!

Natraj – Thai Crown version

Malesome Model
A sketch of a model…AKA Washing Powder Nirma !!!

Small scale IT companies
This was how we used to work our ass off…its hard to beleive that i remember each dialogue that happened some 8 years before, they still haunt me at times…this conversation is in tamil, iam not sure whether this will give the same meaning when i translate this in English, so iam not trying out one…the characters…. P: is the boss : JM and J are the workers, there were some more people in the room, but they were totally dumbstruck!!!!…i hope you can imagine…

most of the small scale IT companies management think the same way…the workers will always give this look…poor but fun…
Candle Painting

A candle created with Gimp, i got inspiration to draw this from a picture my friend took…

the same one with some realistic smoke…instead of a blue one…
Couple at beach !!!

another one photo taken by my friend Sidhu…messed up by me using GIMP !!!!

this one is almost done
-
Archives
- October 2009 (2)
- June 2009 (9)
- May 2009 (5)
- October 2008 (9)
- June 2008 (2)
- April 2008 (1)
- March 2008 (2)
- February 2008 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS
