Giter VIP home page Giter VIP logo

jacraig / craig-s-utility-library Goto Github PK

View Code? Open in Web Editor NEW
418.0 65.0 160.0 126.71 MB

A giant set of utility classes originally start back in the .Net 2.0 days and updated until .Net Core and .Net Standard became a thing. At which point I took the library and broke it up into a ton of smaller libraries. View my profile for more up to date versions of everything.

Home Page: http://jacraig.github.io/Craig-s-Utility-Library/

License: MIT License

C# 80.07% Smalltalk 2.60% ASP 0.01% Batchfile 0.01% HTML 17.28% CSS 0.01% JavaScript 0.04%
utilities utility-library

craig-s-utility-library's People

Contributors

gitter-badger avatar jacraig avatar matthewsteeples avatar rgshare avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

craig-s-utility-library's Issues

HASH and Sha

Hello,

Does Craig Utilities supports SHA256Managed with Salt and Repetitions?

Thank you,
Miguel

Basic IO Conversion

A number of these items are completely changed and will need to be rewritten:

  1. Compression - Not 100% sure if GZip or Deflate is available in .Net Core. Need to look into this.
  2. FileFormats - This needs to be reworked anyway to try to make things a bit more uniform and changed more to a factory/generator setup (you ask for a generator, give the generator the data, generator converts to/from the file format).
  3. FileSystem - This just needs changes to work with .Net Standard. This may mean no more FileInfo, etc. features depending on the level of .Net Standard used. FTP and HTTP may also not be available, but more research needed.
    4, Logging - Just needs to be updated for the new FileSystem.
  4. Messaging - Email isn't in .Net Core... So ???
  5. Serializers - This just needs to be joined with the file formats section. They're just a file type and should be treated that way.

Other portions should be dropped/broken off into their own thing:

  1. Encryption - This really needs to be its own thing and reworked.

Move over file system

The file system is pretty much a given to move over. May have to drop the http/ftp code though.

Basic ORM Conversion

So System.Data had a number of changes but thankfully I did not use many of them. So it should be fairly straight forward. Most of the changes here will be actual enhancements in capabilities.

Basic IoC conversion

A couple of changes that are needed:

  1. .Net Core doesn't support Domains at the moment. So figuring out what assemblies are loaded is not possible and needs to be supplied to the Bootstrapper class.
  2. GetType() no longer gets a type's info in full. So some changes needed for GetTypeInfo().
  3. ASP.Net Core's IoC container uses scopes which the current set of classes don't really use. So adding functionality that is compatible is needed.

Move file formats

I have a library on bitbucket that deals with file formats plus the ones here. Find out what I can move over and just push it over. Should be pretty straight forward for most of them.

Basic Profiler Conversion

Once again it should be straightforward. However thanks to Sundial, I have a number of improvements that I would like to make. Most notably I would like it to be easier to track metrics other than time in the system (memory, CPU, etc).

Unauthenticated Encryption

See here: https://github.com/JaCraig/Craig-s-Utility-Library/blob/master/Utilities/IO/Encryption/BaseClasses/SymmetricBase.cs#L159

This method doesn't include any type of authentication, to be secure, a MAC should be applied. This answer goes into some detail about what you should be doing here.

If you don't authenticate the ciphertext, an attacker can make simple changes to it, and when decrypted, will change the content of the encrypted message. So it's important to ensure the integrity of the message before decrypting it.

Move over logging

Logging code is pretty simple. Shouldn't be too difficult to move over once the file system code is in place.

MathExtensions.Median not following general definition of median

The MathExtensions.Median() function doesn't adhere to the statistical definition of median, that can be found on Wikipedia. This definition states that the value choosen depends on the value count:

If there is an odd number of numbers, the middle one is picked.

If there are an even number of observations, then there is no single middle value; the median is then usually defined to be the mean of the two middle values.

Current implementation takes the value at count / 2, that differs when value count is even with the above definition. When the value count is odd, the current implementation ok.

Basic Web Conversion

Generally speaking I feel these items should be removed from CUL and moved to Ironman. It's really only useful for ASP.Net and I would like to break those items off into the appropriate library.

Basic Validation Conversion

Most of the validation code is fine. IClientValidatable may need to be changed as I do not know if it is available in ASP.Net Core. That said it should be removed anyway to move the code away from ASP.Net specific.

Published package versions are inconsistent

Most NuGet packages for the library are currently at version 4.0.304. CraigsUtilityLibrary-FileFormats is still at 3.4.199, though, and requires the DataTypes and IO packages to be at exactly 3.4.199 as well. That means those cannot be updated to their current versions as long as the FileFormats package is installed.

Would it be possible to re-publish the FileFormats package as version 4.0.304, so the rest of the packages can be used in their most recent versions?

Break off encryption

I've never really been happy with the current system and I'm not sure what is available in .Net Core/Standard. So this is getting broken off most likely.

[Utilities.IoC] BadImageFormatException Unhandled

IoC Manager attempts to load a native DLL thinking it is a Managed DLL.

System.BadImageFormatException: Could not load file or assembly 'freetype6.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
   --- End of inner exception stack trace ---
   at System.Reflection.AssemblyName.nGetFileInformation(String s)
   at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
   at Utilities.IoC.Manager.<>c.<LoadAssemblies>b__13_2(FileInfo x) in Manager.cs:line 167
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Utilities.IoC.Manager.LoadAssemblies() in Manager.cs:line 167
   at Utilities.IoC.Manager..ctor() in Manager.cs:line 44
   at Utilities.IoC.Manager..cctor() in Manager.cs:line 64

Improve speed of IoC code

Pretty much just work on reducing the amount of memory creation and reduce the number of assemblies it looks in. Should reduce the amount of time it takes to boot up.

Basic Media Conversion

So System.Drawing isn't in .Net Core other than a couple of the data types... So a library is needed to read/write images and give access to the pixels. There is ImageProcessor but it's slow and has some weird choices that they've made. On top of that we really just need the Core portion. Finding a decent .Net item that could be used is difficult to find so I have been writing my own library to handle this portion of the code based on the ImageProcessor's Core code but fixing their issues. Once that is done the rest of the code can be moved over without too many issues.

Default Salt Use

See here: https://github.com/JaCraig/Craig-s-Utility-Library/blob/master/Utilities/IO/Encryption/BaseClasses/SymmetricBase.cs#L140

This code supplies a default salt of Kosher - this use defeats the purpose. Please here here for a detailed discussion of how salts should be applied - the key point is that to be effective, they should be random. Relying on a fixed or default salt defeats the purpose.

I would suggest removing the default, and add a method to generate a random salt using a CSPRNG.

Encryption: Default IV

See here:

string InitialVector = "OFRna73m*aze01xY",

...
        public byte[] Encrypt(byte[] Data, string Key,
            string Algorithm,
            string Salt = "Kosher",
            string HashAlgorithm = "SHA1",
            int PasswordIterations = 2,
            string InitialVector = "OFRna73m*aze01xY",
            int KeySize = 256)
        {
...

The use of a default initialzation vector is a security flaw - see here for a breakdown of why this is a bad idea, that document goes into detail for how IVs should be handled for CBC mode, so I won't repeat it all here.

To protect the integrity of encrypted data, this default IV should not be used.

Basic Random Conversion

I'm not 100% happy with this portion of the library. That said it should move over pretty easily. I just need to rework the system into something a bit simpler.

  1. ContactInfoGenerators/NameGenerators/StringGenerators - It's difficult to get to these items or discover them. So it needs to be simplified.
  2. Random - Most of the generators themselves should be fine but the Random class itself needs to be simplified.

Move over compression

I'm not certain if Deflate or GZip are in .net core or .net standard. So... This may be something that gets broken off into its own thing.

Basic Configuration Conversion

Most of the changes will be related to the IO portion of the library. The main changes will be the SystemConfig, JsonConfig, XMLConfig, etc. That said many of the classes may not be needed as most of this can be moved into the FileFormats portion of IO. Obvious exceptions are the SystemConfig class which needs to be changed to remove System.Web references.

Basic DataTypes Conversion

This is where things crash and burn a bit with the new .Net Core stuff. Moving to .Net Standard will require a bunch of work on a number of items:

  1. AOP - This relies on Roslyn to generate the code. This has changed a bit but generally still should work without too many issues.
  2. Caching - Most of the changes are related to ASP.Net Core. The default cache should just be an in memory cache and the other items are broken off as plugins based on the platform.
  3. CodeGen - the Roslyn portion of the AOP generator. This is the part that will need to change.
  4. Comparison - Actually pretty standard and good to go.
  5. Conversion - The converters will need to be changed but otherwise it is pretty straight forward.
  6. DataMapper - Most of the changes will be related to GetType and changes to type conversion.
  7. Extensions - Each of the extensions needs to be looked at but most should be able to move over. A bigger issue is the fact that many of them are no longer needed thanks to changes in C#.
  8. Formatters - Should be able to move it over.
  9. Patterns - Should be able to move it over.
  10. Dynamo - This will take a big set of changes but most of it will be related to the items up the list.
  11. Other classes - Should be pretty simple actually.

Other items really aren't needed:

  1. AI - you should just use Accord.net, numl, or Azure's machine learning library. The Naive Bayes class in here was something I created for a single project and other libraries have more features.

Add scoping capability to IoC container

Basically make it compatible with ASP.Net Core and the IoC container that they use internally. Singleton and creating an item each time was supported but a session based scope wasn't really a consideration so it needs to be reworked. Look to the initial attempt back when doing the changes in 2015.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.