cimbalino / Cimbalino-Phone-Toolkit

Cimbalino Windows Phone Toolkit
MIT License
78 stars 32 forks source link

Error Installing Cimbalino #42

Closed rickwaugh1 closed 10 years ago

rickwaugh1 commented 10 years ago

Trying to install this in Visual Studio 2012. I need the extensions for us of MD5. I get the following error:

You are trying to install this package into a project that targets 'portable-win+net45+wp80', Attempting to resolve dependency 'Cimbalino.Phone.Toolkit.Background (≥ 3.2.3)'. Installing 'Cimbalino.Phone.Toolkit.Background 3.2.3'. Installing 'Cimbalino.Phone.Toolkit 3.2.3'. Successfully installed 'Cimbalino.Phone.Toolkit 3.2.3'. Adding 'Cimbalino.Phone.Toolkit.Background 3.2.3' to Project.Common. Uninstalling 'Cimbalino.Phone.Toolkit.Background 3.2.3'. Successfully uninstalled 'Cimbalino.Phone.Toolkit.Background 3.2.3'. Install failed. Rolling back... Could not install package 'Cimbalino.Phone.Toolkit.Background 3.2.3'. You are trying to install this package into a project that targets 'portable-win+net45+wp80', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

pedrolamas commented 10 years ago

As the error states, the Cimbalino.Phone.Toolkit package is not compatible with portable-win+net45+wp80 PCL projects.

But you're in luck, as last week I released the first beta version of Cimbalino.Toolkit.Portable (source code here), so please try with it instead.

rickwaugh1 commented 10 years ago

We are having a lot of trouble getting this to work. All that we want is the MD5 hashing capability. We have added WP8 toolkit, WP8 toolkit.background, and toolkit.portable. Still having some grief - do we need to add more than that? It keeps telling us that Nuget packages are missing, but when Visual Studio to add missing packages, then rerun it, we still have the same problem.

This is driving us crazy, not being able to get this to work.

On 2014-06-13, 1:25 AM, Pedro Lamas wrote:

As the error states, the |Cimbalino.Phone.Toolkit| package is not compatible with |portable-win+net45+wp80| PCL projects.

But you're in luck, as last week I released the first beta version of |Cimbalino.Toolkit.Portable| (source code here https://github.com/Cimbalino/Cimbalino-Toolkit), so please try with it instead.

— Reply to this email directly or view it on GitHub https://github.com/Cimbalino/Cimbalino-Phone-Toolkit/issues/42#issuecomment-45987114.

Server Developer Finger Food Studios Inc. tel: 604-475-0350 email: rick@fingerfoodstudios.com

skype: rick.waugh4

www.fingerfoodstudios.com

MESSAGES / COMMENTS This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately and return the original message to us at the above address. Thank you.

pedrolamas commented 10 years ago

Rick, none of the 2 versions of the Cimbalino toolkit have a PCL implementation of the MD5 hashing algorithm.

However, you can solve this by creating a custom IMd5Provider interface in your PCL!

Let's say you have this type in your PCL project:

public class MyAwesomeClass
{
    public MyAwesomeClass()
    {
    }
}

Now just create the IMd5Interface and set it as a requirement to build the PCL class, like so:

public interface IMd5Interface
{
    byte[] CalculateMd5(byte[] data);
}

public class MyAwesomeClass
{
    private readonly IMd5Provider md5Provider;

    public MyAwesomeClass(IMd5Provider md5Provider)
    {
        _md5Provider = md5Provider;
    }
}

Then, on each of your projects that will use the PCL, create an implementation of that interface and inject an instance of it in your PCL type that will require calculating an MD5 hash.

To create the implementation, you can just add the Cimbalino.Phone.Background and use the Extension Methods that will add the MD5 calculation stuff!

Does this make sense to you?

rickwaugh1 commented 10 years ago

Heh. I'm not the strongest C# coder in the world, but my team lead is. I'll talk to him.

It's crazy that Microsoft took the crytopgraphy package out. We have a client for whom we have to hash a string to send as part of a URL. That's it. And it's been tough getting anything to work.

On 2014-06-18, 12:34 AM, Pedro Lamas wrote:

Rick, none of the 2 versions of the Cimbalino toolkit have a PCL implementation of the MD5 hashing algorithm.

However, you can solve this by creating a custom |IMd5Provider| interface in your PCL!

Let's say you have this type in your PCL project:

public class MyAwesomeClass { public MyAwesomeClass() { } }

Now just create the |IMd5Interface| and set it as a requirement to build the PCL class, like so:

public interface IMd5Interface { byte[] CalculateMd5(byte[] data); }

public class MyAwesomeClass { private readonly IMd5Provider md5Provider;

 public  MyAwesomeClass(IMd5Provider  md5Provider)
 {
     _md5Provider  =  md5Provider;
 }

}

Then, on each of your projects that will use the PCL, create an implementation of that interface and inject an instance of it in your PCL type that will require calculating an MD5 hash.

To create the implementation, you can just add the |Cimbalino.Phone.Background| and use the Extension Methods that will add the MD5 calculation stuff!

Does this make sense to you?

— Reply to this email directly or view it on GitHub https://github.com/Cimbalino/Cimbalino-Phone-Toolkit/issues/42#issuecomment-46404355.

Server Developer Finger Food Studios Inc. tel: 604-475-0350 email: rick@fingerfoodstudios.com

skype: rick.waugh4

www.fingerfoodstudios.com

MESSAGES / COMMENTS This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately and return the original message to us at the above address. Thank you.

rickwaugh1 commented 10 years ago

We have implemented some of this, but we are not getting the results, sadly. We are using the WP8 toolkit and ByteArrayExtensions.cs. We followed these instructions:

|var myString= "this is my string data";

var myStringBytes= myString.GetBytes(); // this will get the UTF8 bytes for the string

var md5Hash= myStringBytes.ComputeMD5Hash().ToBase64String();|

Which we found at: http://stackoverflow.com/questions/15405628/i-want-to-use-md5-class-to-do-some-encryption-work-but-i-cant-find-it

We have two lines of code:

var inputBytes = inStr.GetBytes();**

var md5Hash = inputBytes.ComputeMD5Hash().ToBase64String();

This results in the following:

Original Value (inStr): vfvasq6lw9lvv8nbdesmondffs123abc1403310093yeyvp2g869akh62f

We get this in md5Hash: lqePhO+hIweEcuZ1lDDjwQ==

But it should be: 96a78f84efa123078472e6759430e3c1

Do you have any ideas as to what we are doing wrong? We have tried a few different conversions, different encoding, with no love.

opsteam@fingerfoodstudios.com On 2014-06-18, 12:34 AM, Pedro Lamas wrote:

Rick, none of the 2 versions of the Cimbalino toolkit have a PCL implementation of the MD5 hashing algorithm.

However, you can solve this by creating a custom |IMd5Provider| interface in your PCL!

Let's say you have this type in your PCL project:

public class MyAwesomeClass { public MyAwesomeClass() { } }

Now just create the |IMd5Interface| and set it as a requirement to build the PCL class, like so:

public interface IMd5Interface { byte[] CalculateMd5(byte[] data); }

public class MyAwesomeClass { private readonly IMd5Provider md5Provider;

 public  MyAwesomeClass(IMd5Provider  md5Provider)
 {
     _md5Provider  =  md5Provider;
 }

}

Then, on each of your projects that will use the PCL, create an implementation of that interface and inject an instance of it in your PCL type that will require calculating an MD5 hash.

To create the implementation, you can just add the |Cimbalino.Phone.Background| and use the Extension Methods that will add the MD5 calculation stuff!

Does this make sense to you?

— Reply to this email directly or view it on GitHub https://github.com/Cimbalino/Cimbalino-Phone-Toolkit/issues/42#issuecomment-46404355.

Server Developer Finger Food Studios Inc. tel: 604-475-0350 email: rick@fingerfoodstudios.com

skype: rick.waugh4

www.fingerfoodstudios.com

MESSAGES / COMMENTS This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately and return the original message to us at the above address. Thank you.

pedrolamas commented 10 years ago

The output format you are showing me is not Base64 string, but the Hexadecimal values of each byte! Something like this should do the job:

var retVal = inputBytes.ComputeMD5Hash();
var sb = new StringBuilder();
for (int i = 0; i < retVal.Length; i++)
{
    sb.Append(retVal[i].ToString("x2"));
}
var hash = sb.ToString();
rickwaugh1 commented 10 years ago

There we go, that works great. Thanks so much, Pedro.

On 2014-06-20, 8:02 PM, Pedro Lamas wrote:

The output format you are showing me is not Base64 string, but the Hexadecimal values of each byte! Something like this should do the job:

var retVal = inputBytes.ComputeMD5Hash(); var sb = new StringBuilder(); for (int i = 0; i < retVal.Length; i++) { sb.Append(retVal[i].ToString("x2")); } var hash = sb.ToString();

— Reply to this email directly or view it on GitHub https://github.com/Cimbalino/Cimbalino-Phone-Toolkit/issues/42#issuecomment-46742934.

Server Developer Finger Food Studios Inc. tel: 604-475-0350 email: rick@fingerfoodstudios.com

skype: rick.waugh4

www.fingerfoodstudios.com

MESSAGES / COMMENTS This message is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately and return the original message to us at the above address. Thank you.

pedrolamas commented 10 years ago

No problem, glad to be of help! :)