|
It really depends on how much security you need.
If you need a lot of security then you're not likely to be able to retain the 10-digit requirement.
If only a little security is need then maybe you don't need any at all.
Can you give more information?
Anyway... this may be an area where just a little security can go a long way; after all, how would someone who intercepts the message know he had correctly deciphered the number?
The following code is an example of a very simple/non-secure encription algorithm, similar to ROT13[^]:
private static readonly System.Collections.Generic.Dictionary<char,char> wombat ;
static Template
(
)
{
wombat = new System.Collections.Generic.Dictionary<char,char>() ;
wombat [ '0' ] = '9' ;
wombat [ '1' ] = '8' ;
wombat [ '2' ] = '7' ;
wombat [ '3' ] = '6' ;
wombat [ '4' ] = '5' ;
wombat [ '5' ] = '4' ;
wombat [ '6' ] = '3' ;
wombat [ '7' ] = '2' ;
wombat [ '8' ] = '1' ;
wombat [ '9' ] = '0' ;
return ;
}
private static string
Wombat
(
string s
)
{
System.Text.StringBuilder result = new System.Text.StringBuilder() ;
foreach ( char c in s )
{
if ( wombat.ContainsKey ( c ) )
{
result.Append ( wombat [ c ] ) ;
}
else
{
result.Append ( c ) ;
}
}
return ( result.ToString() ) ;
}
If more security is required, you could extend this to provide for passing a "key" between partners, but you would then need separate encription and decription methods.
|
|
|
|
|
for my case, i have P-1234-1000042373.
which i need to encrypt the final 10 digit into another integer combination.
which mean it still readable by human. because when user enter in this key, it should be numeric form and it is not suppose to be very long, or else user will feel ...
and maybe i gona encrypt all 14 digit which is 12341000042373 together into numeric form also..if possible
erm, if you can make one with the encrypted output not very long or short
something like 12-13 or 15-16 @_@
i appreciate ur reply..thx u so much
|
|
|
|
|
wSheng87 wrote: P-1234-1000042373.
wSheng87 wrote: encrypt the final 10 digit
A Regular Expression can be used to split them off.
|
|
|
|
|
I was practicing coping files in C# console application. I have only one execuitable and i am trying to copy that execuitable using File.Copy method inside that execuitable. I know this sounds stupid but can be done and if yes how.
|
|
|
|
|
Yep - add the following using statment
...
using System.IO;
...
then in your code do something like this:
...
File.Copy(@"C:\test.exe", @"C:\Temp\test.exe");
...
|
|
|
|
|
string str = "hai";
Console.WriteLine(str==str);
Console.WriteLine("Hello"+str==str);
Output:
True
False
Have doubt in second,... why did not print "Hello" and why print False instead of True
|
|
|
|
|
Hi,
you should check the documentation on operator precedence to find out whether
"Hello"+str==str is the same as "Hello"+(str==str)
or is the same as ("Hello"+str)==str
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Argh, beat me to it!
|
|
|
|
|
|
anishkannan wrote: why did not print "Hello" and why print False instead of True
I guess there's a common reason for...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
For Console.WriteLine(str==str);
here compiler checks "hai" is "hai" or not !!
Compiler : Yes
So your Console.WriteLine(str==str); is "True".
For Console.WriteLine("Hello"+str==str);
now the compiler checks is "Hellohai"(the outcome of "Hello"+str) is "hai".
"Hellohai" == "hai"
Compiler : no
So your Console.WriteLine("Hello"+str==str); is "False".
The key portion here is C# operator Precedence.
|
|
|
|
|
Hi,
I have configured the ASPNET membership database to use for security. I am planning on using Client Application Services with WinForms so that I may be able to have one UserID for the website and the Desktop App.
How can I check the UserId tag in the aspnet_Users table in order to populate a WinForm with information for the specific user?
Currently I have a PersonTable that has a One-To-One relationship with aspnet_users and the Person Table has a One-To-One relationship with the EmployeeTable and a One-To-One relationship with the ClientTable.
Thank you!
Illegal Operation
|
|
|
|
|
Illegal Operation wrote: How can I check the UserId tag in the aspnet_Users table in order to populate a WinForm with information for the specific user?
Are you able to do this from ASP.NET? If yes, best way is to create a web service which will use membership provider APIs. Your windows application can just call this service without messing with ASP.NET APIs.
|
|
|
|
|
What I need to do is reinsert all records exactly as they are from the backup table back into a new table in their corresponding fields.
I am sure there is a better way. The way I would go about doing this is passing a sql reader looping and reinserting the records from 1 table to the other. However this also mess's up the index on the new table.
The new table is structurally different but it has all the same fields as the orgional table, only different order, plus additional fields.
Any good Ideas on what the best way to tackle this? and keep the index's the same?
|
|
|
|
|
JollyMansArt wrote: What I need to do is reinsert all records exactly as they are from the backup table
Ask the question in the correct forum.
only two letters away from being an asset
|
|
|
|
|
debugged a code that calculated savings at 5,10 and 15% for 10, 20, 30, 40 years. The display showed the column heading/information of the percentages whereas the rows held the information for the years. Problem I am having is switching the display to show the years information in the columns and the percentages in the rows. Used a loop to do the first one can't figure out how to change the loop to reflect the other way.
|
|
|
|
|
Could you show some code please? This really isn't enough for me to help you
|
|
|
|
|
This is what was inputted
string employeeName = Console.ReadLine();
Console.Write("Please input your salary: ");
string inputSalary = Console.ReadLine();
double salary = int.Parse(inputSalary);
double balance5Percent = 0.0;
double balance10Percent = 0.0;
double balance15Percent = 0.0;
Console.WriteLine();
Console.WriteLine("{0} at your current salary of {1:C} these are your expected balances", employeeName, salary);
Console.WriteLine();
Console.WriteLine(" 5% 10% 15%");
Console.WriteLine("=========================================================");
for (int i = 1; i <= 40; i++)
{
balance5Percent = (salary * 0.05 + balance5Percent) * 1.08;
balance10Percent = (salary * 0.10 + balance10Percent) * 1.08;
balance15Percent = (salary * 0.15 + balance15Percent) * 1.08;
if (i % 10==0)
{
Console.WriteLine(" Year {0} {1,14:C} {2,14:C} {3,14:C}", i, balance5Percent, balance10Percent, balance15Percent);
}
}
Console.WriteLine("=========================================================");
Console.ReadLine();
}
}
}
|
|
|
|
|
And now instead of 40 lines, you want 40 columns?
That doesn't seem to be especially hard to me - what have you tried?
|
|
|
|
|
No, it is 4 columns instead 3 and now 3 rows with information
|
|
|
|
|
No, the first program was 4 rows with 3 columns now I need 4 columns with 3 rows.
|
|
|
|
|
This[^] may well be what you want.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I see in near every example using threads that the method to execute in the starting of the threads belong to a different class
example: ThreadStart TH = new ThreadStart(Animal1.CuentaAnimales);
Thread Thread1 = new Thread(TH);
And it suggest to me some questions, please tell me if i´m correct or not.
1) Every Thread must include it´s own data an methods so it creates an object for keeping all the code isolates in it´s own space.
2) One Tread cann´t use methods or data created in other Threads.
3) How can I Share one object like a List or Dictionary between different threads.
Best Regards
|
|
|
|
|
1 - no, but if you have multiple threads that all access the same data, make sure you lock it to stop race conditions
2 - not so
3 - just declare it, and access it. Use the lock keyword to make sure each thread waits it's turn.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
About synchronization I see that all the synchronization tools like Lock, Monitor, Mutex need an object like parameter, but I dont know which object I need to introduce for synchronizing a method in the same class in such case I don`t understand to use Lock(this) or Monitor(this), I`m not sinchronizing all the class but only a method.
Thanks
|
|
|
|