Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Converting Base 02 to Base 10 [help]

Was wondering if anyone was able to help me out on this.
I need a function to convert base 02 (binary) to base 10.
Thanks everyone for your time!
Have you tried here first? http://goo.gl/L1zZw

I don't know anything about this, not trying to be sarcastic or anything, but yeah. Just checking
[Image: IMG-6011.png] Remotely Control your iOS Devices.
http://msdn.microsoft.com/de-de/library/...s.71).aspx
Did you checked out this yet?
This is the difference between Base2 and Base10. But what you've stated in your post doesn't conform with what the title says, so which is it that you are trying to do?

(Dec 19, 2012 09:41 PM)SIM-1327690 Wrote:  Was wondering if anyone was able to help me out on this.
I'm writing a multi-layered encryption algorithm and have fine tuned it to the point I just need to be able to create a function that converts an 8-bit byte into its decimal form.

Thanks everyone for your time!

A) Convert each byte (8-bit) into Decimal - Byte > Decimal.
B) Convert the 8 bits to its Decimal representative.

???

🤨

Code
Dim b As Byte = &HFF
Dim i As Integer = CInt(b)
Console.WriteLine(i)
Console.ReadKey()

Code
'255 (Dec) = 11 (Binary)
Dim bin As Integer = Convert.ToInt32("11", 2)
Console.WriteLine(bin)
Console.ReadKey()
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
I guess I should've just said converting from base-2 to base 10, sorry for that confusion.
Thanks everyone for your input!
[Image: I7SVV.png]

[Image: U5RYg.png]

Here are two algorithms I wrote earlier in the year that you can use. You only asked for the first but you (or anybody else) could make use of the second in the future :p
Perhaps a better structure for functions would be to make them conform to the TryParse() paradigm. I don't see much benefit in making it return an error string when that same returned string value could also be valid output. It just means you'd have to check the output yourself after the fact anyways, which is mainly a waste of time if you already knew at one point that it was invalid.

It's like having one person go to make sure that he took care of something, and then because this person doesn't tell anybody else anything for confirmation, another person always has to come and check after the fact anyways. Not very efficient.

Returning error strings and mixing the return value with good output is bad habit, and also defined in coding practices provided by MSDN.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
(Dec 20, 2012 09:12 PM)0xDEAD10CC Wrote:  Perhaps a better structure for functions would be to make them conform to the TryParse() paradigm. I don't see much benefit in making it return an error string when that same returned string value could also be valid output. It just means you'd have to check the output yourself after the fact anyways, which is mainly a waste of time if you already knew at one point that it was invalid.

It's like having one person go to make sure that he took care of something, and then because this person doesn't tell anybody else anything for confirmation, another person always has to come and check after the fact anyways. Not very efficient.

Returning error strings and mixing the return value with good output is bad habit, and also defined in coding practices provided by MSDN.

You did not see the context in which I implemented these functions. I used these functions to return a value to print to a console window. In procedural programming, functions are used to break down code. Rather than creating a long method with ambiguous self-documentation I broke the control in to separate functions which is perfectly acceptable. There is no such thing as a be all end and all design pattern, you know.
(Dec 20, 2012 10:07 PM)+Bourbon Wrote:  You did not see the context in which I implemented these functions. I used these functions to return a value to print to a console window. In procedural programming, functions are used to break down code. Rather than creating a long method with ambiguous self-documentation I broke the control in to separate functions which is perfectly acceptable. There is no such thing as a be all end and all design pattern, you know.

No, but there are standards, like OOP. You don't have to do everything OOP, but it's probably better that you do as it upholds a good design pattern. You don't have to follow the strict guidelines given by the nature of OOP, but it's also still better that you probably do so.

To the point: The reason being is because, now if he goes to use your function, or anybody else for that matter, what if they do not use it to write to the console in the way you do, and they need the validation? Not saying they can't modify your function, but that's why I will point this out. Because I know that there's probably some out there who will take your function for granted, and do something stupid like this:

Code
If ByteBlastsFunction() = "This is the error value from the function" Then
'Error
Else
'Get to it
End If
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
Yeah guys so just looking for a function to convert base 02 to base 10, if anyone can provide help it'd be much appreciated.
[Image: nNeLo.png]

There you go, finally!
..............................
Hey HF
Im also have one question about convertation text to hex and revert
Im using this class (pastebin) and its working only with text. When im trying to convert any other symbols, like vbNewline, vbTab etc. im got stuck of output (screenshot)
Spoiler (Click to View)Can anyone help me?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by +TOASTFeb 16, 2013 02:14 PM 5 245 Feb 16, 2013 02:14 PM
Last Post: MrZander
[Java] by Howard StarkSep 30, 2012 07:27 PM 0 65 Sep 30, 2012 07:27 PM
Last Post: Howard Stark
[C#] by codepoetMar 21, 2010 04:50 PM 4 169 Mar 21, 2010 04:50 PM
Last Post: codepoet