Coder Social home page Coder Social logo

Swift on Linux support about rethink-swift HOT 15 OPEN

pixelspark avatar pixelspark commented on May 28, 2024 1
Swift on Linux support

from rethink-swift.

Comments (15)

pixelspark avatar pixelspark commented on May 28, 2024

Hi @demom! I am not currently working on Linux support, but this certainly would be interesting to have. I think the main issue is porting the network code (the driver currently uses GCDAsyncSocket, but there should be a Linux alternative available for that).

So feel free to give it a try and let me know if there's anything I can do.

/Tommy :)

from rethink-swift.

johnbona avatar johnbona commented on May 28, 2024

Hi @pixelspark!

Now that SPM support is in #7, I'm currently working on Linux support but going to have to switch GCDAsyncSocket and SCRAM to Swift-based implementations.

Do you prefer having two separate smaller PR's (one for networking and one for SCRAM) instead of one larger PR? Almost completed converting the network code over to vapor/socks.

from rethink-swift.

pixelspark avatar pixelspark commented on May 28, 2024

Great to hear you're working on Linux support, @johnbona! Smaller PR's are preferred as they are a bit easier for me to test/review. Not sure what you had in mind re/ SCRAM, I guess it shouldn't be too difficult to rewrite in Swift and remove any Objective C code altogether (assuming vapor/socks works on macOS too?)

from rethink-swift.

johnbona avatar johnbona commented on May 28, 2024

Vapor/socks works on macOS as well.

Wanted to get your thoughts on crypto. CryptoSwift is all Swift but requires, on average, 130.55 ms to generate the HMACs when performing SCRAM auth. Vapor's crypto library does have a C dependency (LibreSSL) but on average only takes 32.54 ms for the same test.

Have SCRAM auth working using vapor/crypto at the moment but if you prefer not having C dependencies, I can switch over. 👍

krzyzanowskim/CryptoSwift vapor/crypto
112.425982952118 ms 39.5439863204956 ms
138.751983642578 ms 29.2920470237732 ms
133.029997348785 ms 29.2499661445618 ms
125.846982002258 ms 29.9699902534485 ms
142.695963382721 ms 34.6269607543945 ms

from rethink-swift.

pixelspark avatar pixelspark commented on May 28, 2024

@johnbona that's quite a difference in performance! Did you compile CryptoSwift in release mode with all optimizations turned on?

Ideally speaking we'd be fully Swift native - as the SCRAM authentication is only performed once when a connection is established, I don't think the lower performance is an issue. If we can be sure that libressl (or equivalent) is available on all platforms we compile on, then on the other hand I don't think we should use a separate implementation. So for now, feel free to stick with your libressl based solution if that gets the Linux port out of the door faster - we can always still switch to CryptoSwift afterwards.

from rethink-swift.

jrahaim avatar jrahaim commented on May 28, 2024

What is the status of getting this working on Linux? Package manager seems to be working fine, but what about the Crypto and GCD Stuff? is there anything I can help with?

from rethink-swift.

pixelspark avatar pixelspark commented on May 28, 2024

@jrahaim no news from my side but perhaps @johnbona has made some progress?

from rethink-swift.

matthijs2704 avatar matthijs2704 commented on May 28, 2024

Any news regarding this @johnbona, @pixelspark ?

from rethink-swift.

pixelspark avatar pixelspark commented on May 28, 2024

@matthijs2704 sorry, no news from my side. Haven't heard from @johnbona either. His last work on this is from september last year (see https://github.com/johnbona/rethink-swift). Now assuming this contains the SCRAM stuff, I think the only other thing to do is to start using a portable sockets layer (could be vapor/socks or IBM-Swift/BlueSocket). Shouldn't be too difficult - anyone wants to step up?

from rethink-swift.

matthijs2704 avatar matthijs2704 commented on May 28, 2024

@pixelspark I just noticed that that fork already got merged into this one! I thought I'd give it a shot to move to Vapor/Sockets. I'll create a PR for that, so you can check what I've done.

from rethink-swift.

matthijs2704 avatar matthijs2704 commented on May 28, 2024

For Linux support also the SCRAM stuff needs to be rewritten in Swift (Swift on linux does not support Obj-C code). I've started doing this on matthijs2704/rethink-swift on the linux-travis branch. If you have a little spare time, could you take a look at it, as I'm not able to rewrite the xor function (in Utils.swift) in a way it matches the obj-c version, therefore the authentication doesn't work...

from rethink-swift.

pixelspark avatar pixelspark commented on May 28, 2024

@matthijs2704 have you seen this? https://github.com/CryptoKitten/SCRAM

from rethink-swift.

matthijs2704 avatar matthijs2704 commented on May 28, 2024

Yes I have and I have used that. But CryptoKitten is deprecated and the source pretty outdated, so I had to update it. But for some reason the xor from the current SCRAM givs a different output from the CryptoKitten varient

from rethink-swift.

pixelspark avatar pixelspark commented on May 28, 2024

Hm. Might be some endianness issue then?

from rethink-swift.

matthijs2704 avatar matthijs2704 commented on May 28, 2024

@pixelspark fixed it! Now I 'only' need to figure out why the data isn't being sent on Linux...

from rethink-swift.

Related Issues (8)

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.