-5

I do not know PHP, could anyone explain me how $data.$prop looks on C#? If $data has "some_data" value and $prop has "some_other_data" value, the $data.$prop is "some_data.some_other_data", Right?

I would like to implement next line on C#: sha1(md5($data.$prop)). There is concatenation of strings inside of brackets?

Maxim Polishchuk
  • 334
  • 6
  • 17
  • I'm sorry how are you relating php with c# – Christian Stewart Mar 12 '13 at 18:53
  • @Christian, I have description of API on PHP. I am going to invoke required service via ASP.NET. – Maxim Polishchuk Mar 12 '13 at 18:57
  • 1
    Note that you shouldn't be hashing hashes. It does *not* increases the security of those hashes. You should just use a better hashing algorithm to begin with. – Servy Mar 12 '13 at 18:58
  • @Servy, I think you are right, but I need generate and send required hash value. Service will generate value by the same algorithm above and compare it. I just try to reproduce this algorithm on C# :) – Maxim Polishchuk Mar 12 '13 at 19:19

2 Answers2

2

You can find out more about SHA1 here and about MD5 here. In C# string concatenation is done with operator +. So if you have two variables named data and prop, both strings, you would concatenate them with the following code:

string result = data + prop;

You have the examples for using cryptography classes on the links provided.

Toni Petrina
  • 7,014
  • 1
  • 25
  • 34
0

It depends on the what $data and $prop are.

If they are strings

They will will be concatenated.

If $data is a object and $prop is a property

You need to look at reflection. See C# Reflection: How to get class reference from string? for more info.

Community
  • 1
  • 1
Bart
  • 17,070
  • 5
  • 61
  • 80