Schneier's stuff is generally regarded as the best around. Applied Cryptography (https://www.schneier.com/book-applied.html[^]) is probably the best you're going to find on the subject. The book itself is a little dated, but it's still a very, very good reference, and the majority of the topics are still relevant today. It's a very technical, and requires a working knowledge of C and some advanced mathematics. He's got some other less technical books as well on the subject of cryptography - Practical Cryptography is decent if you don't want to know the inner workings, but want to know how to effectively select correct algorithms and implement cryptography. I haven't read Cryptography Engineering yet, it's supposed to be a second edition of Practical Cryptography. I'm not sure if it gets as technically detailed as Applied. A list of his books are at https://www.schneier.com/books.html[^]
Matt Meyer
Posts
-
Encryption and decryption -
sending mailsTrue, standards can be ignored but it's worth pointing out that the ports listed weren't just arbitrarily chosen by the service provider. 995 is used for encrypting the POP3 protocol (POP3S, another standard :-D ). Port 465 is an old remnant from Exchange's method of encryption. It's become common due to Outlook/Microsoft's support of Exchange over the Submission port standard in their mail clients. These days, both protocols are supported in Outlook. One other note about 465 is that it will break using System.Net.Mail.SmtpClient due to how the encryption was implemented. See the remarks section at http://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.enablessl.aspx[^] for the details.
-
sending mailsDave Kreskowiak wrote:
Hotmail and Yahoo will probably not use the same port numbers
Port 587 is a standard for SMTP servers (similar to port 25), usually referred to as the 'submission' port. It's set aside for authenticated users to submit messages to the e-mail service. It typically needs encryption, but I don't believe that's a requirement of the standard. https://www.ietf.org/rfc/rfc2476.txt[^]
-
Reading Null values in a byte arrayWhen thinking in terms of bytes (or any integral types), null and 0 are the same. In your example, when this line
variable = BitConverter.ToInt32(message, (int)position);
returns a zero, that would correspond to a null value.
-
Problem connecting to MySQLWhat happens if you try to connect to the database using a standard MySQL client? It almost looks like a firewall may be blocking your connection.
-
DNS propagation > 72 hoursThat all depends on how the SOA record is configured. Servers will cache the DNS records for as little or as much time as it is instructed to hold it for. Well.. properly configured servers will, it's anybody's guess for the misconfigured servers out there. Edit: To check your SOA record with nslookup.exe, run the following:
C:\>nslookup -type=soa domain.com
It should return the SOA in a human-readable format for you.
-
Why VB is popular in America!Well, much like VB itself, our elevators are not designed for programmers... :-D
-
Help with DriveInfo. VolumeLabel exception pleaseI'm going to change your life (just like mine was a few years back...) :-D
if (d.VolumeLabel == null || d.VolumeLabel.Length == 0) {
Can be written as this:
if (string.IsNullOrEmpty(d.VolumeLabel)) {
-
How do I generate a Unique AlphaNumeric ID in C#Guid should already satisfy your requirement in creating unique identifiers. They're already a product of cryptographic hashing functions, so you shouldn't need to hash them again. You can use ToString with a format provider to get a string representation of the value without the dashes. Or, as an alternative, you can always roll your own UUID implementation according to the standards. One other note - GetHashCode isn't a cryptographic hash, nor is it guaranteed to be consistent between frameworks or platforms. Check the Remarks section at MSDN.
-
How can i change regex to work in javascriptThe forward slashes are causing your problems because they're telling the interpreter that it's the end of the expression since they're not escaped. Converting your expression from the original into the javascript should only require a copy/paste and manually escaping the pattern's forward slashes. Ie,
(?:https?|ftp|file)://|www\.|ftp\.)
becomes(?:https?|ftp|file):\/\/|www\.|ftp\.)
Here's a Regex reference for javascript that can help you convert your expression: http://www.w3schools.com/jsref/jsref_obj_regexp.asp[^] Also, there's a regular expression forum on here: http://www.codeproject.com/Forums/1580841/Regular-Expressions.aspx[^] They will probably give you more help about regex syntax problems than the javascript forum. -
How can we restrict a user from changing the download path url's fine name.You accomplish this by keeping your assets in a non-accessible location (eg, somewhere in
App_Data
) and using an HttpHandler to serve the files out after verifying permissions. -
Speed of executionNope, don't know how to make it faster. I did try a few different loop approaches, but I get the impression they're being optimized down by the compiler into the same thing. They all seem to come out roughly the same speed (within a ms of each other). If you need something faster, you're going to be better off using C/C++. And, just for kicks, I did try using raw pointer arithmetic in an unsafe context. It was still coming out slower then just looping. I found this odd...
-
Speed of executionYou have some goofy stuff in there that shouldn't be needed. You're creating a pointer to your array (which requires the unsafe context), then you use your pointer as if it were the array:
byte[] data = new byte[size];
[...]
unsafe{
fixed (byte* ptr = data) {
[...]
for (int i = 0; i < size; i++)
ptr[i] = 128;
[...]
}
}All of that should be condensed down to this:
byte[] data = new byte[size];
[...]
for (int i = 0; i < size; i++)
data[i] = 128;Give that a whirl and see how the speeds match up. I'm not sure what performance implications unsafe contexts create.
-
Reading a file in local drive using Java scriptI do welcome the drag and drop features (this is probably the most common request I used to have when doing web stuff). However, I don't like the idea of implicitly agreeing to local file access by just selecting something in a file input field. Especially since Firefox forces you into the file dialog when you focus on the field, and you cannot delete the input field's contents after selecting a file.
-
Reading a file in local drive using Java scriptGraham Breach wrote:
No, you cannot do that just using Javascript from a browser.
Actually... You used to not be able to do it with a browser (was viewed as a security hole). However, with HTML5, browsers have started putting in functionality to trap the filestream when a user selects a file in the input box. More details are here: http://www.html5rocks.com/en/tutorials/file/dndfiles/[^] Personally, I still view it as a security problem because I remember all of the details from back in the day, but my opinions don't seem to be falling in line with the new generation of web folks. (yea, yea, get off my lawn and all that) :)
-
xml to htmlYou might want to look into using XSLT for translating your XML into something HTML friendly.
-
How to add a Second ParameterI used string literals in my example. If you want the variables themselves (and they're at least protected), you can do this:
<%# String.Format("return showComment(""{0}"",""{1}"")", Parameter1, Parameter2) %>
where Parameter1 and Parameter2 are variable names in the page object.
-
How to add a Second ParameterYou have a second quote before Parameter2.
-
Who to write HTML code using CsharpYou could create a file that is the template and contains the content of the markup. for example:
blah blah blah...
{0}
{1}
{3}Then you can read in that file and use that in a single string.Format line to create the files from a template.
public void DesignPage(string TemplateFile, string OutputFile, string[] Contents){
/* skipping file checks, array checks, etc */
string content = File.ReadAllText(TemplateFile);
content = string.Format(content, Contents);
File.WriteAllText(OutputFile, content);
/* clean up, etc */
}You can also update the file templates without having to recompile, etc.
-
How to add a Second ParameterYou can using String.Format directly in the binding:
<%# String.Format("return showComment(""{0}"",""{1}"")", "Patameter1", "Parameter2") %>